从昨天开始,我将 OpenSSL-1.0.2h 应用于我的 Nginx 服务器,我从源代码重新编译了它。对于 OpenSSL 部分,我遵循了以下指南:https://syslint.com/blog/tutorial/how-to-upgrade-openssl-on-centos-7-or-rhel-7/之后编译 Nginx 就相对容易了:
./configure --prefix=/etc/nginx ... --with-openssl=/usr/local/src/openssl-1.0.2h
背景信息
$ openssl version
OpenSSL 1.0.2h 3 May 2016
$ which openssl
/usr/bin/openssl
$ ls /usr/bin/openssl
/usr/bin/openssl -> /usr/local/ssl/bin/openssl
$ find / -name "openssl"
...
/usr/include/openssl
/usr/local/src/openssl-1.0.2h/apps/openssl
/usr/local/src/openssl-1.0.2h/include/openssl
/usr/local/src/openssl-1.0.2h/.openssl/include/openssl
/usr/local/src/openssl-1.0.2h/.openssl/bin/openssl
/usr/local/ssl/include/openssl
/usr/local/ssl/bin/openssl
...
$ nginx -V
nginx version: nginx/1.11.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.2h 3 May 2016
$ ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013
$ php -i
...
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1e-fips 11 Feb 2013
OpenSSL Header Version => OpenSSL 1.0.1e-fips 11 Feb 2013
Native OpenSSL support => enabled
...
不幸的是,在 Google 上搜索 PHP 文档(http://php.net/manual/en/openssl.installation.php) 对我没有帮助。我考虑通过提供以下内容,使用最新的 OpenSSL 重新编译 PHP:
./configure -disable-shared ... --with-openssl=/usr/local/src/openssl-1.0.2h
然而这告诉我:
configure: error: Cannot find OpenSSL's libraries
任何帮助都将不胜感激!
答案1
我认为您应该安装 openssl-devel( yum install openssl-devel
)。然后您可以使用最新的 OpenSSL 重新编译 PHP。