centos curlinit php_centos7系统 lnmp环境 php Curl 无法访问https ,更换ssl_version NSS为openssl...

本文介绍了如何在CentOS 7系统上解决PHP Curl无法访问HTTPS的问题。通过从NSS切换到OpenSSL,详细步骤包括下载curl源码、编译安装、配置动态共享文件及重启服务。
摘要由CSDN通过智能技术生成

cat /etc/redhat-release

CentOS Linux release 7.5.1804 (Core)

这是已经更换完成的效果

下面说步骤:

1.查看本机curl 版本

curl -V

curl 7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.2k zlib/1.2.7 libidn/1.28

Protocols: tftp ftp telnet dict http file https ftps

Features: IDN IPv6 Largefile NTLM SSL libz

2.下载

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

3.解压

tar -zxf curl-7.19.7.tar.gz

4.编译安装

cd curl-7.19.7

./configure --without-nss --with-ssl

make && make install

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

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

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

ldconfig

这一部很重要,否则php的curl就是不会支持openssl

6.查看新安装后curl的版本

curl -V

curl 7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.2k zlib/1.2.7 libidn/1.28

Protocols: tftp ftp telnet dict http file https ftps

Features: IDN IPv6 Largefile NTLM SSL libz

7.重启你的httpd/nginx服务和php服务器

service nginx restart #或service httpd restart

service php-fpm restart

参考以下命令:

PHP-FPM状态管理:/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}

Nginx状态管理:/etc/init.d/nginx {start|stop|reload|restart}

MySQL状态管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}

Memcached状态管理:/etc/init.d/memcached {start|stop|restart}

PureFTPd状态管理: /etc/init.d/pureftpd {start|stop|restart|kill|status}

ProFTPd状态管理: /etc/init.d/proftpd {start|stop|restart|reload}

Redis状态管理: /etc/init.d/redis {start|stop|restart|kill}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值