Page 1 of 1

OpenSSL Path

PostPosted: 06. July 2015 19:51
by bma1
Hello All,

I have XAMPP 5.6.8 installed on Windows 2008 R2 server. I have updated the PHP that came with the 5.6.8 release to Apache/2.4.12 (Win32) OpenSSL/1.0.1m from version l. I have enabled OpenSSL in the php.ini file by uncommenting extension=php_openssl.dll.
After restarting Apache, going to phpinfo() page shows the OpenSSL module loaded:
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.1m 19 Mar 2015
OpenSSL Header Version OpenSSL 1.0.1m 19 Mar 2015
In Apache>conf>extra>httpd-xampp.conf I have updated the variable to:
SetEnv OPENSSL_CONF "P:/xampp/apache/conf/openssl.cnf" from SetEnv OPENSSL_CONF "P:/xampp/apache/bin/openssl.cnf"

The problem I have is every time i open openssl.exe in the Apache bin folder, I get the message WARNING: can't open config file: c:/openssl-1.0.1m-win32/ssl/openssl.cnf. I have searched for an answer to this and have not had any luck so far. Going to the openssl.exe in the command prompt as an admin and putting the command there actually got me farther than the error in genrsa messages I was getting before in Apache>bin>openssl.exe itself:
OpenSSL> genrsa -out server.key 2048
Loading 'screen' into random state - done
Generating RSA private key, 2048 bit long modulus
.+++
Putting in the request for a csr gets a similar message to the opening warning:
OpenSSL> req -new -key server.key -out request.csr
Unable to load config info from c:/openssl-1.0.1m-win32/ssl/openssl.cnf
error in req

How do we resolve that c:/openssl-1.0.1m-win32/ssl/openssl.cnf message? Some search results say to set the environment path variable, but there is no openssl folder in that directory. If the message cannot be resolved, how do I generate a cert request?

Thanks!

Re: OpenSSL Path

PostPosted: 07. July 2015 18:43
by bma1
So, I guess this isn't an easy fix. As a workaround I have installed a server certificate, root CA certificate, publishing CA certificate, and server key into the respective folders in Apache>conf and modified httpd-ssl.conf. SSL works perfectly fine now. This thread can be locked unless there is a solution for the original problem.

Thanks!

Re: OpenSSL Path

PostPosted: 08. July 2015 22:41
by gsmith
It's an easy fix, your understanding is wrong.
SetEnv in Apache has nothing to do when you open a command prompt console. SetEnv is internal to Apache and any processes it spawns only.

Before calling openssl, use the "Set" command at the command prompt.

SET OPENSSL_CONF "C:/xampp/apache/conf/openssl.cnf"

then you can start making your certificate.

Re: OpenSSL Path

PostPosted: 09. July 2015 15:43
by bma1
Hmmm will try that, thanks!

Re: OpenSSL Path

PostPosted: 13. March 2021 11:57
by riopiedra
Small correction for the recommended command line, before running openssl.exe:

SET OPENSSL_CONF=C:/xampp/apache/conf/openssl.cnf