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

 2023-12-25  阅读 2  评论 0

摘要:首先确认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-Negoti

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

首先确认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

新的

转载至: https://blog.jam00.com/article/info/38.html

提示:现在腾讯云新人点击注册然后实名认证后,可以点此一键领取2860元代金券,然后点此进入腾讯云活动页面参加优惠力度非常大的腾讯云3年和5年时长服务器活动,一次性买多年,免得续费贵,这样就可以获得最大的优惠折扣,省钱。

版权声明:xxxxxxxxx;

原文链接:https://lecms.nxtedu.cn/yunzhuji/144572.html

发表评论:

验证码

管理员

  • 内容1196554
  • 积分0
  • 金币0
关于我们
lecms主程序为免费提供使用,使用者不得将本系统应用于任何形式的非法用途,由此产生的一切法律风险,需由使用者自行承担,与本站和开发者无关。一旦使用lecms,表示您即承认您已阅读、理解并同意受此条款的约束,并遵守所有相应法律和法规。
联系方式
电话:
地址:广东省中山市
Email:admin@qq.com
注册登录
注册帐号
登录帐号

Copyright © 2022 LECMS Inc. 保留所有权利。 Powered by LECMS 3.0.3

页面耗时0.0109秒, 内存占用341.49 KB, 访问数据库18次

  • 我要关灯
    我要开灯
  • 客户电话
    lecms

    工作时间:8:00-18:00

    客服电话

    电子邮件

    admin@qq.com

  • 官方微信

    扫码二维码

    获取最新动态

  • 返回顶部