Socket transport "ssl" in PHP not enabled

Socket transport "ssl" in PHP not enabled

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Socket transport "ssl" in PHP not enabled on Windows

When fsockopen() fails with the message "Unable to find the socket transport 'ssl'", it signals a specific configuration gap in your PHP environment, particularly on Windows. The error explicitly states that the underlying OpenSSL libraries are missing or inaccessible, regardless of whether you have uncommented the relevant .dll extensions in php.ini. Simply enabling the extension tells PHP to look for these libraries; if they aren't found at runtime, the connection attempt fails immediately.

On Linux, this dependency is often bundled by default, but on Windows IIS, the situation requires manual intervention with binary files. You have correctly identified that php_openssl.dll and php_sockets.dll must be loaded, which you have done. However, the critical missing piece in your current setup is the presence of the legacy OpenSSL binaries themselves: ssleay32.dll and libeay32.dll. These are not optional; they are the native C libraries required by the PHP OpenSSL extension to establish secure SSL/TLS connections. Without these specific files present in a directory listed in the system PATH or the current working directory, Windows cannot load them, resulting in the exact error you are seeing.

Your attempt to copy ssleay32.dll and libeay32.dll into multiple locations—including the main PHP folder, WINDOWS, and SYSTEM32—is a logical troubleshooting step, but it introduces a potential point of confusion regarding version compatibility. The versions of these DLLs must match your compiled version of php_openssl.dll. If you downloaded a pre-compiled OpenSSL package for Windows (such as from the official Visual Studio build site or a trusted archive), ensure that the architecture matches: a 32-bit PHP installation requires 32-bit OpenSSL binaries. Placing 64-bit DLLs in a 32-bit environment, or vice versa, will result in a "bad image" error or a silent failure to load.

To troubleshoot this systematically using process of elimination, you should verify the order of priority for Windows DLL loading. When PHP starts, it searches for dependencies in the following order:

  1. The directory containing php_openssl.dll.
  2. The system PATH environment variable.
  3. The Windows System folder (System32).

If your main PHP installation folder contains both php_openssl.dll and the corresponding ssleay32.dll, you technically do not need to copy them to SYSTEM32 or WINDOWS. However, if you are running into issues where the DLLs aren't found despite being in the same directory, check your PHP error log. The log will often provide a more verbose message indicating exactly which DLL failed to load and why (e.g., "The module 'C:\path\to\php_openssl.dll' is not loaded" or "Bad image format").

Another common pitfall on IIS is the distinction between 32-bit and 64-bit applications. Ensure that your PHP version matches your IIS worker process (w3wp.exe). If you installed a 64-bit version of PHP into C:\PHP but configured IIS to run as a 32-bit application, it will try to load 32-bit DLLs from a non-existent location or fail entirely. You can verify the architecture by creating a simple test file with phpinfo() and searching for "Architecture". It should read either "x64" or "x86", which must align with your OpenSSL binaries.

If you have copied the files to multiple locations, try isolating the issue by removing duplicates. Sometimes, having conflicting DLLs in different paths can cause the loader to pick the wrong one. Clean up the directories and ensure only the matching set of ssleay32.dll and libeay32.dll exist alongside your PHP binaries.

Once the DLLs are correctly placed and architecture-matched, restart IIS. If the error persists, check if the OpenSSL version is too old for your PHP build. Modern versions of PHP (7.x and 8.x) often require OpenSSL 1.0 or higher, whereas older builds might expect OpenSSL 0.9.6. Mismatched library versions can cause the extension to fail initialization even if the files are present.

For developers looking to avoid these binary dependency headaches entirely in future projects, consider using a package manager like Composer with the ext-openssl dependency or switching to a Docker container that bundles PHP and OpenSSL correctly. For existing IIS setups, ensuring the binary compatibility between the PHP extension and the native OpenSSL libraries is the definitive fix.

Our network