Command Line PHP with SSL
Posted by: fathertems (---.ronkva.east.verizon.net)
Date: September 26, 2012 09:13PM

I am trying to use fsockopen with an SSL connection in PHP. It does not work on the command line but it does work through a browser. This is a problem because the PHP code is intended to be run as a daemon from the command line (gathering tweets from Twitter).

I figure it must be my environment. If I look at phpinfo through a browser it reports that Registered Stream Socket Transports have tcp, udp, ssl, sslv3, sslv2, tls.

But if I go to my MinGW shell and echo "<? php phpinfo(); ?>" | php I only get tcp and udp.


Also the command line phpinfo doesn't list the Apache environment as the browser one does.


I have php_openssl checked and the php.ini is right. I have the Apache ssl_module checked. On the recommendation of various forums and blogs I have copies libeay32.dll and ssleay32.dll into every conceivable location. Still command line phpinfo says only tcp and udp.

Any ideas where my environment has gone wrong?

Options: ReplyQuote
Re: Command Line PHP with SSL
Posted by: stevenmartin99 (Moderator)
Date: September 26, 2012 10:24PM

Firstly your probably editing the wrong php.ini

The command line php uses the php.ini in the php folder

Apache php uses the php.ini in the apache/bin folder.



Secondly why would you expect to see the apache environment In the phpinfo for cli!?
That's the whole point of cli , it doesn't use the apache exe to run, it uses its own exe...

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Command Line PHP with SSL
Posted by: fathertems (---.cns.vt.edu)
Date: September 26, 2012 11:37PM

Ahh!! Thank you so much! I had not realized that there are different php.ini files for Apache and for PHP. Talk about banging a head against a wall.

Options: ReplyQuote


Sorry, only registered users may post in this forum.