Using SSL socket in PHP under Windows
Problem
If you try to open a socket (fsockopen, pfsockopen) with SSL in PHP 4.x under Windows, the operation might fail with the following message: Warning: fsockopen(): no SSL support in this build
This problem occurs even if phpinfo() shows openssl as loaded and the command php -m shows openssl as one of the loaded module.
Cause
To use SSL in sockets, PHP core must be compiled with OpenSSL, which is not the case with the binary available at php.net. On the other hand, the openssl module only enables the OpenSSL functions (functions prefixed openssl_). According to the bug report linked below, “OpenSSL support enabled” that phpinfo() states just means that the openssl extension is available.
Solution
This problem has been identified and labeled “won’t fix” in the offical PHP distribution (details). You have the following options:
- Upgrade to PHP 5.x, which does not have such problem.
- If you are using PHP 4.3.x, you can download a (unofficial) SSL-enabled php4ts.dll.
- Use PHP’s curl extension (which is supported by the Windows binary from php.net) instead.