# Using SSL socket in PHP under Windows

## Problem

If you try to open a socket (fsockopen, pfsockopen) with <span class="caps">SSL</span> in <span class="caps">PHP</span> 4.x under Windows, the operation might fail with the following message: <tt>Warning: fsockopen(): no <span class="caps">SSL</span> support in this build</tt>

This problem occurs even if phpinfo() shows openssl as loaded and the command <tt>php -m</tt> shows openssl as one of the loaded module.

## Cause

To use <span class="caps">SSL</span> in sockets, <span class="caps">PHP</span> 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](http://us.php.net/openssl) (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 <span class="caps">PHP</span> distribution ([details](http://bugs.php.net/bug.php?id=20014)). You have the following options:

- Upgrade to <span class="caps">PHP</span> 5.x, which does not have such problem.
- If you are using <span class="caps">PHP</span> 4.3.x, you can [download a (unofficial) <span class="caps">SSL</span>-enabled php4ts.dll](http://files.edin.dk/php/win32/openssl/).
- Use PHP’s [curl extension](http://se.php.net/manual/en/ref.curl.php) (which is supported by the Windows binary from php.net) instead.