title: PHP OpenSSL - openssl_private_encrypt crashes webpage
body: <p>This has been reported at <a href="https://bugs.php.net/bug.php?id=55470&amp;edit=1" rel="nofollow noreferrer">bugs.php.net</a>. If I replace <strong>libeay32.dll and ssleay32.dll</strong> in <code>xampp/apache/bin</code> with the same files in <code>xampp/php/</code> then it works but I <strong>CANNOT use SSL</strong> </p>
  
  <p>I need to use SSL, has anyone been able to resolve this?</p>
  
  <hr>
  
  <p>I am using <strong>OpenSSL</strong> library in <strong>PHP</strong>(5.4.7) on <strong>XAMPP</strong>(1.8.1) for encryption, decryption, etc. I am also using SSL on localhost.</p>
  
  <p>I am able to create the private-public key pair using <code>openssl_pkey_new()</code> method and generate the certificate as well.</p>
  
  <p>But when I try to access my root certificate (create using the above function) the <strong>webpage crashes</strong>:</p>
  
  <pre><code>$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);
  </code></pre>
  
  <p>I even tried using <strong>phpseclib library</strong> but that also does the same thing.</p>
  
  <p>I have also tried to set <code>ini_set('max_execution_time', 0);</code></p>
  
  <hr>
  
  <p>I checked <strong>PHP log</strong> and it is empty and found the following in <strong>Apache logs</strong>: </p>
  
  <pre><code>[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.
  </code></pre>
  
  <hr>
  
  <p>I have tried following but none of that helps:</p>
  
  <p><a href="https://stackoverflow.com/questions/8423799/php-openssl-public-encrypt-causing-page-timeout-connection-reset">PHP openssl_public_encrypt causing Page Timeout/Connection Reset?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1610420/php-timeout-connection-to-server-reset?rq=1">php/timeout/connection to server reset?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13603960/apache-server-xampp-crashes-when-using-openssl-function">Apache server (xampp) crashes when using openssl function</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16409439/php-dies-unexpectedly-without-error?rq=1">PHP dies unexpectedly without error</a></p>
  
  <p>I would appreciate any help/suggestion.</p>