You might get error – “Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?” when you are trying fsockopen() function of PHP. If your PHP is not compiled with open_ssl support then you could not open a secured connection through fsockopen(). We can test the code snippet here –
$fp = fsockopen("ssl://www.google.com", 443, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.google.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
If open_ssl is not complied with PHP or it is not enabled from php.ini file, you will see that error.
Solution in Linux:
Compile PHP with open_ssl, command-
–with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)
Windows with XAMP:
- Stop your Apache service
- Find libeay32.dllandssleay32.dllinxampp\php\folder, and copy it intoxampp\apache\bin\folder. Overwrite the older files in there.
- Edit php.inifile inxampp\apache\bin, remove the semicolon in “;extension=php_openssl.dll”
- Start the Apache service
Windows with WAMP2:
- From WAMP tray menu, go to PHP Extension
- Check php_openssl
- Apache will be restarted
You are done!