Centos curl NSS库更换为OpenSSL库

Centos默认安装的curl用的SSL版本是NSS库,因此需要对curl重新编译

安装必要组件

安装升级openssl和openssl-devel

yum install openssl openssl-devel

下载

curl下载地址:http://curl.haxx.se/download/archeology/

wget https://curl.haxx.se/download/archeology/curl-7.19.7.tar.gz

解压压缩包

tar zxf curl-7.19.7.tar.gz

编译安装

进入目录

cd curl-7.19.7

编译

# -–without-nss 禁用NSS, -–with-ssl启用OpenSSL的支持
./configure --prefix=/usr --without-nss --with-ssl

安装

make && make install

将curl的库载入动态共享文件并生效

echo "/usr/local/lib" >> /etc/ld.so.conf

生效

ldconfig

验证

curl -V

查看信息内 NSS 是否替换为 OpenSSL ,如已替换贼更换 OpenSSL 库成功。

这时候重启或者reloadphp-fpm ,再确认下phpinfo,如果线上禁止phpinfo,可用如下命令确认。

php -i | grep "SSL Version"

返回的SSL Version是OpenSSL说明更换成功。

发表新评论