1

This has been reported at bugs.php.net. If I replace libeay32.dll and ssleay32.dll in xampp/apache/bin with the same files in xampp/php/ then it works but I CANNOT use SSL

I need to use SSL, has anyone been able to resolve this?


I am using OpenSSL library in PHP(5.4.7) on XAMPP(1.8.1) for encryption, decryption, etc. I am also using SSL on localhost.

I am able to create the private-public key pair using openssl_pkey_new() method and generate the certificate as well.

But when I try to access my root certificate (create using the above function) the webpage crashes:

$root_private_key = openssl_get_privatekey(file_get_contents($path), $pass);
echo "KEY: " . $root_private_key; // KEY: Resource id #11
openssl_private_encrypt($plaintext, $encrypted_data, $root_private_key);

I even tried using phpseclib library but that also does the same thing.

I have also tried to set ini_set('max_execution_time', 0);


I checked PHP log and it is empty and found the following in Apache logs:

[mpm_winnt:notice] [pid 3312:tid 484] AH00428: Parent: child process exited with status 3221225477 -- Restarting.
[ssl:warn] [pid 3312:tid 484] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[mpm_winnt:notice] [pid 3312:tid 484] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[mpm_winnt:notice] [pid 3312:tid 484] AH00456: Server built: Aug 18 2012 12:41:37
[core:notice] [pid 3312:tid 484] AH00094: Command line: 'apache\\bin\\httpd.exe -d C:/xampp/apache'
[mpm_winnt:notice] [pid 3312:tid 484] AH00418: Parent: Created child process 1520
AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:19
[ssl:warn] [pid 1520:tid 496] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[mpm_winnt:notice] [pid 1520:tid 496] AH00354: Child: Starting 150 worker threads.

I have tried following but none of that helps:

PHP openssl_public_encrypt causing Page Timeout/Connection Reset?

php/timeout/connection to server reset?

Apache server (xampp) crashes when using openssl function

PHP dies unexpectedly without error

I would appreciate any help/suggestion.

6
  • Where exactly it crashes? Commented May 18, 2013 at 19:25
  • If I don't use openssl_private_encrypt() method then it runs fine. Commented May 18, 2013 at 19:28
  • It seems like that it is failed to get the private key. Commented May 18, 2013 at 19:34
  • I read private key from file and output of echo $root_private_key; is Resource ID # Commented May 18, 2013 at 19:36
  • Please print the resource ID. Commented May 18, 2013 at 19:41

4 Answers 4

2

For those of you still having trouble:

Until a fully packaged official build of xampp is released with the next version of apache which should fix this bug, I have successfully fixed this issue by changing my version of Apache to one found here: http://www.apachelounge.com/download/ This fixes the bug but still allows me to use OpenSSL

The second Apache 2.2.4 download on this page was built specifically to fix this bug. For me it was easy as:

  • Stopping Apache
  • Renaming xampp\apache to xampp\apacheold just in case it broke.
  • Copied in the Apache24 to xampp\Apache24 from the downloaded zip
  • Renamed it to apache
  • Copied the .bat files from the xampp\apacheold folder into the new xampp\apache folder.
  • Replaced the xampp\apache\conf folder with the one from xampp\apacheold
  • Start Apache again

I Hope this helps somebody.

Sign up to request clarification or add additional context in comments.

1 Comment

In addition to your steps, I had to copy the libraries ssleay32.dll and libeay32.dll from "xampp \ php" and paste in "xampp \ apache \ bin". It worked perfectly.
1

This has been reported at bugs.php.net. If I replace the following files in xampp/apache/bin with the same files in xampp/php/ then it works:

  • libeay32.dll
  • ssleay32.dll

BUT, SSL cannot be used otherwise Apache gives error when starting up.

3 Comments

Is there a solution to this that fixes the problem but doesn't force me to disable SSL? I need both.
@nathanjosiah Sorry, I couldn't find any solution. The only way I could make it work was by disabling SSL.
Hi, I solved my problem copying libeay32.dll and ssleay32.dll from the PHP folder to my Apache bin, like 'ska-pig' answered in php.net
0

phpseclib uses OpenSSL, if available, for RSA private key generation. To disable this behavior do this after Crypt/RSA.php has been included:

define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL);

How big, btw, is the key you're trying to generate?

Comments

0

From my side I had:

  • IIS on Windows 11
  • PHP 7.0
  • libeay32.dll and ssleay32.dll v1.0.2.8

I found the 2 dlls somewhere in visual studio in the simulator with version 1.0.2.19, I have replaced them both and it started working. It was for the function openssl_pkcs7_sign where it was crashing all the time.

Hope this helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.