Home » Php » php – Can't find ordinal 372 in WAMP/Apache's openssl.exe

php – Can't find ordinal 372 in WAMP/Apache's openssl.exe

Posted by: admin July 12, 2020 Leave a comment

Questions:

The PHP framework I use needs OpenSSL for various features, but when executing anything related to OpenSSL, I get the following error: “Can’t find ordinal 372 in DLL-file C:\wamp64\bin\apache\apache2.4.17\bin\openssl.exe”.

I don’t know how to correct this at all, I looked everywhere already. I’d appreciate the help, as I don’t know how to fix this.

How to&Answers:

To fix the issue, two things are needed:

1) Make sure that you don’t have symbolic links for libeay32.dll and ssleay32.dll in your Apache bin directory
(For example, mine is: C:\wamp64\bin\apache\apache2.4.23\bin)

If you do have symbolic links (i.e. the file size are 0 bytes), you need to download the dlls from Apache Lounge.
For example, I grabbed the two .dll files from the 64-bit version of Apache 2.4.23 hosted at https://www.apachelounge.com/download/

2) Once you have the actual .dll files restored, you need to make sure that WampServer isn’t overwriting them. WampServer 3 has a configuration script that runs every time it starts. In that script it will overwrite those .dlls with symbolic links. You must DISABLE that functionality. To do so, comment out the references to those two files in: C:\wamp64\scripts\config.inc.php (mine were located at lines 133 and 139).

That should allow you to enable the mod_ssl module in Apache. You’ll also need to uncomment the “Include conf/extra/httpd-ssl.conf” after you get Apache booting properly with mod_ssl enabled. (However, you’ll likely need to delete most of whats in there and start over since it includes lots of hardcoded paths and bugs)

Answer:

… “Can’t find ordinal 372 in DLL-file C:\wamp64\bin\apache\apache2.4.17\bin\openssl.exe”

I’m speculating its PEM_SealInit or SSL_CONF_cmd_argv from OpenSSL 1.0.2; or ASN1_i2d_fp or SSL_SESSION_set1_id_context from OpenSSL 1.1.0.

# OpenSSL 1.1.0
$ find $PWD -type f -iname '*.num' -exec grep " 372" {} \;
ASN1_i2d_fp                             372   1_1_0   EXIST::FUNCTION:STDIO
SSL_SESSION_set1_id_context             372   1_1_0   EXIST::FUNCTION:
...

# OpenSSL 1.0.2
$ find $PWD -type f -iname '*.num' -exec grep " 372" {} \;
PEM_SealInit                            372   EXIST::FUNCTION:RSA
SSL_CONF_cmd_argv                       372   EXIST::FUNCTION:
...

You will need to verify it by using dumpbin or Dependency Walker. Also see How can I find the exported function name from ordinal (export by ordinal)? on Stack Overflow.


The ordinals are created using <openssl src>\util\mkdef.pl. You can see the source code from OpenSSL’s GitHub presence. Here is 1.0.2 and here is 1.1.0.

Here are the head comments for the file:

#!/usr/local/bin/perl -w
#
# generate a .def file
#
# It does this by parsing the header files and looking for the
# prototyped functions: it then prunes the output.
#
# Intermediary files are created, call libcrypto.num and libssl.num,
# The format of these files is:
#
#   routine-name    nnnn    vers    info
#
# The "nnnn" and "vers" fields are the numeric id and version for the symbol
# respectively. The "info" part is actually a colon-separated string of fields
# with the following meaning:
#
#   existence:platform:kind:algorithms
#
# - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is
#   found somewhere in the source, 
# - "platforms" is empty if it exists on all platforms, otherwise it contains
#   comma-separated list of the platform, just as they are if the symbol exists
#   for those platforms, or prepended with a "!" if not.  This helps resolve
#   symbol name variants for platforms where the names are too long for the
#   compiler or linker, or if the systems is case insensitive and there is a
#   clash, or the symbol is implemented differently (see
#   EXPORT_VAR_AS_FUNCTION).  This script assumes renaming of symbols is found
#   in the file crypto/symhacks.h.
#   The semantics for the platforms is that every item is checked against the
#   environment.  For the negative items ("!FOO"), if any of them is false
#   (i.e. "FOO" is true) in the environment, the corresponding symbol can't be
#   used.  For the positive itms, if all of them are false in the environment,
#   the corresponding symbol can't be used.  Any combination of positive and
#   negative items are possible, and of course leave room for some redundancy.
# - "kind" is "FUNCTION" or "VARIABLE".  The meaning of that is obvious.
# - "algorithms" is a comma-separated list of algorithm names.  This helps
#   exclude symbols that are part of an algorithm that some user wants to
#   exclude.

Answer:

I just encountered the same problem, on Windows and using xampp instead of Wamp.

Doing what’s described in the commentaries of this page solved it : PHP cURL Installation.

I copied the 3 .dll files from the PHP installation directory to the apache/bin directory and rebooted xampp.