Windows – Apache SSL on 64-bit Windows (not a valid Win32 application)

32bit-64bitapache-2.2sslwindows

I have created a portable (relative paths) Apache installation. It works perfectly on my 32-bit system, but when I try to run it on a 64-bit system, it gives the following error:

>httpd -t
httpd: Syntax error on line … of …/httpd.conf: Cannot load …/modules/mod_ssl.so into server: %1 is not a valid Win32 application.

If I comment out the line that includes SSL.conf, then the server runs on the 64-bit system, but of course without SSL support.

I have tried searching for this but cannot find anything helpful. Does anybody know how to get Apache to use SSL on a 64-bit system (preferably in a way that is compatible with a 32-bit system)?

Best Answer

Using Process Monitor, I observed the file and registry entry accesses that Apache makes when loading.

I noticed that httpd loads the file libeay32.dll at the end of the trace (just before it errors out). I tried putting a copy of libeay32.dll from a 64-bit Apache package I got from ApacheLounge in Apache’s bin directory, but it still gave the same error. (I suppose that should not be a surprise, because the file it was previously loading was a already a 64-bit copy from some folder—which is in the PATH—where one of the laptop’s 64-bit drivers are installed.)

I then put a 32-bit copy of libeay32.dll (and ssleay32.dll) that I got from the standard package, et voilà! Apache runs with SSL support on a 64-bit system! Moreover, because the copy of libeay32.dll is 32-bits, it still runs on the 32-bit system without modification (i.e., no detecting the system and replacing files or even conf-file hacks)!

(I’m glad I put the error message in the title of the question because it will hopefully help direct others with this problem—which I struggled with for several months—to this page where they can finally find the solution. ☺)