centos系统中php Curl 无法访问https 的解决办法

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

  1. 查看系统自带的curl版本
[root@localhost local]# curl -V
curl 7.19.7
  1. 得到curl当前版本是7.19.7,去官方下载http://curl.haxx.se/download/archeology/ 同样版本,然后解压、编译。
wget http://curl.haxx.se/download/archeology/curl-7.19.7.tar.gz
tar -zxf curl-7.19.7.tar.gz
cd curl-7.19.7
./configure --without-nss --with-ssl
make && make install

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

  1. 将curl的库载入动态共享文件,并重新加载
echo "/usr/local/lib" >> /etc/ld.so.conf 
ldconfig
  1. 查看新安装后curl的版本
[root@localhost local]# curl -V
curl 7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1e zlib/1.2.3 libidn/1.18
Protocols: tftp ftp telnet dict http file https ftps 
Features: IDN IPv6 Largefile NTLM SSL libz 
  1. 重启你的httpd/nginx服务和php服务器
service nginx restart #或service httpd restart
service php-fpm restart
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容