phpopensslxampppublic-key-encryptionphpseclib

PHP OpenSSL - openssl_private_encrypt crashes webpage


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.


Solution

  • 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:

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