刚迁移到新机器并遇到问题。
注意:这是 Windows 7、Apache 2.2.21、MySQL 5.5.16、php 5.3.8 设置。
每次我运行某个 PHP 脚本时,我都会遇到“页面加载错误 - 连接已重置”。我知道该脚本在使用各种 echo 语句调用函数之前有效,但调用:
openssl_public_encrypt();
我的页面超时。我已将适当的 openssl.dll PATH 添加到我的 Windows 配置设置 (D:\xampp\php\etc),但我的实际本地主机上仍然出现页面超时错误(以及上述错误)。
页面返回:
The connection was reset
- The connection to the server was reset while the page was loading.
apache ssl 日志显示:
[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() 显示:
**
开放式
**
OpenSSL support | enabled
----------------------------------------------------------
OpenSSL Library Version | OpenSSL 1.0.0e 6 Sep 2011
----------------------------------------------------------
OpenSSL Header Version | OpenSSL 0.9.8r 8 Feb 2011
-
我的库和 header 版本不应该匹配吗?这可能是我出错的原因吗?
最佳答案
请注意,这是在最新版本的 apache 和 php 中发现的错误。 Apache 版本使用了不兼容的文件。要解决(暂时只在本地机器上):
替换您的 xampp/apache/bin 文件夹中的以下两个文件:
- libeay32.dll
- ssleay32.dll
与您的 xampp/php 文件夹中的同名文件。我立即解决了这个问题。
关于PHP openssl_public_encrypt 导致页面超时/连接重置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8423799/