Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

windows - PHP openssl_public_encrypt causing Page Timeout/Connection Reset?

Just migrated to a new machine and having issues.

Note: This is a Windows 7 , Apache 2.2.21, MySQL 5.5.16, php 5.3.8 setup.

Each time I run a certain PHP script, I am faced with a "Page Load Error - The connection was reset". I know the script works before the function call with various echo statements but calling:

openssl_public_encrypt();

I am given a page timeout. I have added the appropriate openssl.dll PATH to my windows configuration settings (D:xamppphpetc) but I am still getting page timeout errors on my actual localhost machine (and the errors above).

The page returns:

The connection was reset

  • The connection to the server was reset while the page was loading.

The apache ssl logs show:

[Wed Dec 07 15:13:17 2011] [info] Loading certificate & private key of SSL-aware server

[Wed Dec 07 15:13:17 2011] [debug] ssl_engine_pphrase.c(470): unencrypted RSA private key - pass phrase not required

[Wed Dec 07 15:13:17 2011] [info] Configuring server for SSL protocol

[Wed Dec 07 15:13:17 2011] [debug] ssl_engine_init.c(465): Creating new SSL context (protocols: SSLv2, SSLv3, TLSv1)

[Wed Dec 07 15:13:17 2011] [debug] ssl_engine_init.c(420): Configuring TLS extension handling

[Wed Dec 07 15:13:17 2011] [debug] ssl_engine_init.c(795): Configuring RSA server certificate

[Wed Dec 07 15:13:17 2011] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?

[Wed Dec 07 15:13:17 2011] [debug] ssl_engine_init.c(834): Configuring RSA server private key

PHPinfo() shows:

**

openssl

**

OpenSSL support          |  enabled
----------------------------------------------------------
OpenSSL Library Version  |  OpenSSL 1.0.0e 6 Sep 2011
----------------------------------------------------------
OpenSSL Header Version   |  OpenSSL 0.9.8r 8 Feb 2011 

-

Shouldn't my library and header versions match? Could this be the cause of my error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Of note, this is an error found in recent versions of apache and php. The Apache version used non-compatible files. To resolve (temporarily on local machines only):

Replace the following two files in your xampp/apache/bin folder:

  • libeay32.dll
  • ssleay32.dll

with the files of the same name in your xampp/php folder. The issue was resolve for me immediately.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...