php修改ssl版本号,PHP-把curl扩展的SSL版本从NSS改为OpenSSL

首先确认curl的

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

并没有 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

2e7dc4af4f1c419c7d32f69b6d283a8e.png

新的

b7a0567c4584c2885df8253b973984e7.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值