centos 6.10升级curl支持http2

/ 0评 / 0
yum install epel-release -y
yum -y install libnghttp2 libnghttp2-devel
yum -y install libev libev-devel zlib zlib-devel
wget --no-check-certificate https://www.openssl.org/source/openssl-1.0.2f.tar.gz
wget --no-check-certificate  https://curl.se/download/curl-7.61.1.tar.gz

tar zxf openssl-1.0.2f.tar.gz
cd openssl-1.0.2f
./config --prefix=/usr/local/openssl enable-shared
make
make test
make install
/usr/local/openssl/bin/openssl version

mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln –s /usr/local/openssl/include/openssl /usr/include/openssl

echo '/usr/local/openssl/lib' >> /etc/ld.so.conf
ldconfig

cd ~
tar zxf curl-7.61.1.tar.gz
./configure --with-nghttp2 --with-ssl=/usr/local/openssl --enable-share
//这里结束后可以看见  HTTP2 support: enabled (nghttp2)

make
make install

mv /usr/bin/curl /usr/bin/curl.7.19.7
cp /usr/local/bin/curl /usr/bin/
curl --version
curl 7.61.1 (x86_64-pc-linux-gnu) libcurl/7.61.1 OpenSSL/1.0.2f zlib/1.2.3 nghttp2/1.6.0
Release-Date: 2018-09-05
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 TLS-SRP HTTP2 UnixSockets HTTPS-proxy 

测试支持

php openssl升级
还用当前PHP版本的源码重新编译一次PHP
通过php -i查找之前的configure
php -i | grep configure
编辑重新编译(不影响之前的配置(扩展,配置文件),直接编译即可。)
./configure   --prefix=/opt/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-libxml-dir --enable-shared --with-iconv --with-mcrypt --without-pdo-sqlite --with-gettext=/usr --with-curl --enable-mbregex --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mbstring --with-mhash --enable-pcntl --with-config-file-path=/opt/php/etc --enable-dom --with-xsl --with-openssl=/usr/local/openssl/ --enable-simplexml --enable-roxen-zts --enable-zip --enable-bcmath --enable-sockets --enable-shmop

make && make install
在重启php 通过php -i 查找openssL支持已升级
openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2f  28 Jan 2016
OpenSSL Header Version => OpenSSL 1.0.2f  28 Jan 2016


发表评论

邮箱地址不会被公开。 必填项已用*标注