没有所谓的捷径
一切都是时间最平凡的累积

PHP-把curl扩展的SSL版本从NSS改为OpenSSL

本文最后更新:2020年3月13日,已超过1498天未更新,如果文章内容失效,请留言反馈本站。

首先确认curl的ssl版本是不是openssl

curl --version
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

并没有 OpenSSL

安装

cd /usr/local/src
wget https://curl.haxx.se/download/curl-7.58.0.tar.gz
tar -zxvf curl-7.58.0.tar.gz
cd curl-7.58.0
./configure --prefix=/usr/local/curl/ --without-nss --with-ssl
make && make install

备份默认的curl二进制文件

mv /usr/bin/curl /usr/bin/curl.bak

做一个新的curl软链

ln -s /usr/local/curl/bin/curl /usr/bin/curl

再次查看curl版本和支持情况

curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.0.1e zlib/1.2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets HTTPS-proxy

已有 OpenSSL

进入之前安装php的源码目录,重新编译php

找到之前安装的编译参数

/usr/local/php/bin/php -i | grep configure

或者找到文件 /usr/local/php/bin/php-config,其中 configure_options 就为编译参数

php源码目录下执行

./configure --prefix=/usr/local/php --with-curl=/usr/local/curl \
--with-freetype-dir --with-gd --with-gettext --with-iconv-dir \
--with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli \
--with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite \
--with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl \
--with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath \
--enable-libxml --enable-inline-optimization --enable-gd-native-ttf \
--enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl \
--enable-shmop --enable-soap --enable-sockets --enable-sysvsem \
--enable-sysvshm --enable-xml --enable-zip
 
make
make install

使用phpinfo查看是否支持openssl

PHP-把curl扩展的SSL版本从NSS改为OpenSSL

新的PHP-把curl扩展的SSL版本从NSS改为OpenSSL

» 站长码字辛苦,有用点个赞吧,也可以打个
» 若转载请保留本文转自:豫章小站 » 《PHP-把curl扩展的SSL版本从NSS改为OpenSSL》
» 本文链接地址:https://blog.mydns.vip/2673.html
» 如果喜欢可以: 点此订阅本站 有需要帮助,可以联系小站
赞(0) 打赏
声明:本站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,若涉及侵权请及时告知,将会在第一时间删除,联系邮箱:contact@mydns.vip。文章观点不代表本站立场。本站原创内容未经允许不得转载,或转载时需注明出处:豫章小站 » PHP-把curl扩展的SSL版本从NSS改为OpenSSL
分享到: 更多 (0)

评论 5


  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #5

    Thank you, I have recently been looking for info approximately this subject for a long time and yours is the greatest I have found out so far.

    바카라사이트4年前 (2020-05-25) 17:33回复
  2. #4
  3. #3

    I love this site – its so usefull and helpfull.

    JamesDweno4年前 (2020-04-24) 02:14回复
  4. #2

    Many thanks really handy. Will share website with my good friends.

    BrianBog4年前 (2020-04-04) 07:15回复
  5. #1

    You’re a very useful web site; could not make it without ya!

    BrianBog4年前 (2020-03-17) 02:53回复

智慧源于勤奋,伟大出自平凡

没有所谓的捷径,一切都是时间最平凡的累积,今天所做的努力都是在为明天积蓄力量

联系我们赞助我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏