centos系统中php Curl 无法访问https ,更换ssl_version NSS为openssl

在centos 6上面,curl模块的ssl 支持默认为NSS,涉及到的程序里有https,是需要双向认证的,这时使用NSS会报错,所以需要更换为openssl.

一、查看系统自带的curl的版本

 
 
  1. [root@localhost local]# curl -V
  2. curl 7.19.7

二、得到curl当前版本是7.19.7,我们去官方下载http://curl.haxx.se/download/archeology/ 同样版本,然后解压、编译。

 
 
  1. wget http://curl.haxx.se/download/archeology/curl-7.19.7.tar.gz
  2. tar -zxf curl-7.19.7.tar.gz
  3. cd curl-7.19.7
  4. ./configure --without-nss --with-ssl
  5. make && make install

#–without-nss 禁用nss, –with-ssl启用openssl的支持.

三、将curl的库载入动态共享文件,并重新加载

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

四、查看新安装后curl的版本

 
 
  1. [root@localhost local]# curl -V
  2. curl 7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1e zlib/1.2.3 libidn/1.18
  3. Protocols: tftp ftp telnet dict http file https ftps
  4. Features: IDN IPv6 Largefile NTLM SSL libz

五、重启你的httpd/nginx服务和php服务器

 
 
  1. service nginx restart #或service httpd restart
  2. service php-fpm restart
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值