Apache Failed to Load php_openssl.dll Module

Q

How to resolve the "The ordinal nnnn could not be located in the dynamic link library LIBEAY32.dll" error when trying to start Apache httpd server? I am want to use openssl.dll module in PHP scripts.

✍: FYIcenter.com

A

You are the "The ordinal nnnn could not be located in the dynamic link library LIBEAY32.dll" error when trying to start Apache httpd server on a Windows system, because Windows is loading the wrong version of the LIBEAY32.dll file.

Here is what happened:

  • When you start Apache httpd server, Windows will load the C:/local/php/php7apache2_4.dll, as defined the httpd.conf configuration file.
  • Windows will then load C:\local\php\ext\php_openssl.dll, as defined in C:\local\php\php.ini configuration file.
  • Windows will then search and load libeay32.dll, as required by php_openssl.dll.
  • Windows will first look at the C:\local\apache\bin and it will find a copy of libeay32.dll, which is provided by Apache package and load it.
  • Unfortunately, the Apache copy of libeay32.dll is not compatible with php_openssl.dll. Windows will stop loading php_openssl.dll and returns an error.

A quick solution is the following:

  • Stop Apache httpd server.
  • Rename C:\local\apache\bin\libeay32.dll to C:\local\apache\bin\libeay32_apache.dll.
  • Copy C:\local\php\libeay32.dll to C:\local\apache\bin\libeay32.dll. This is ensure Windows loads the PHP copy of libeay32.dll.
  • Start Apache httpd server.

php_openssl.dll will be loaded correctly now and you should be able to use OpenSSL functions in your PHP scripts.

However, you may run into issues with other Apache functions that requires the Apache copy of libeay32.dll.

2016-09-09, 3866🔥, 0💬