php fsockopen unable to connect ssl extension under Windows XP/Vista

Tuesday, 26 January 2010

php fsockopen unable to connect ssl extension under Windows XP/Vista

I've been testing with PayPal sandbox on my Windows Vista machine.
It is running Apache/2.0.59 (Win32) PHP/5.2.12
My php is installed in c:\php5 yours could be in c:\php

My goal was to use fsockopen with "ssl://" stream but I was receiving this error:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.sandbox.paypal.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
My Solution

1. I had to enable: php_openssl.dll from php.ini

extension=php_openssl.dll

2. I also made sure that extension_dir points to my extension directory, not the default ./ location.

extension_dir = "c:/php5/ext"

3. I found the comment of mtudor AT icefusion DOT co uk very valuable.
I renamed these 2 files so the same files are loaded from c:\php5

C:\Apache2\bin\ssleay32.dll => old-ssleay32.dll
C:\Apache2\bin\ssleay32.dll => old-libeay32.dll

If everything is OK your phpinfo(); should list these stream socket transports
Registered Stream Socket Transports     tcp, udp, ssl, sslv3, sslv2, tls
Related

Good luck!
Svetoslav

 Digg  Del.icio.us  Reddit  SlashDot

10 comments:

SiseL said...

thank you for your solution. helps a lot! :)

Svetoslav Marinov said...

great! :)

Sergio said...

Great! In my case, i don't need to rename the files in Apache. I only enable the open_ssl.

Svetoslav Marinov said...

cool

Hassan said...

thanks alot

Anonymous said...

Thank u friend it helped me a lot...
god bless!

Svetoslav Marinov said...

cool

Anonymous said...

This was very helpful, thanks.

Sajjadul RObin said...

I just need to enable ssl extension:
extension=php_openssl.dll
in php.ini file.

Voila!! that's working. And please stop this recaptcha. It's pathetic.

Eduardo Cooper said...

Thank you a lot, very useful post!