免费人成网站视频在线观看国内,久视频精品线在线观看,人妻激情偷乱频一区二区三区,国产 字幕 制服 中文 在线

Linux系統安裝Curl2.0擴展,讓cUrl支持HTTP2.0_云主機和虛擬主機_奇迪科技(深圳)有限公司(m.cheanjie.com)

歡迎來(lái)到奇迪科技(深圳)有限公司,超值服務(wù)提供卓越產(chǎn)品!

云主機和虛擬主機

Linux系統安裝Curl2.0擴展,讓cUrl支持HTTP2.0

作者:Qvdv 來(lái)源:m.cheanjie.com 更新時(shí)間:2024-02-24

現階段Linux中的PHP環(huán)境,自帶的Curl不支持HTTP2,如果你要用到Curl模塊,建議升級為支持HTTP2的Curl2.0,要cUrl支持HTTP2.0,須先安裝nghttp2,然后重新編譯PHP,最好是在配置WEB環(huán)境之處就在Linux系統中給PHP安裝Curl2.0擴展。

想要cUrl支持HTTP2.0,那就必須先安裝nghttp2然后再重新編譯cUrl,下面介紹如何在Linux系統安裝Curl2.0擴展,讓cUrl支持HTTP2.0:

1、安裝nghttp2的指令:

[root@host root]# git clone https://github.com/tatsuhiro-t/nghttp2.git
[root@host root]# cd nghttp2/
[root@host nghttp2]# autoreconf -i
[root@host nghttp2]# automake
[root@host nghttp2]# autoconf
[root@host nghttp2]# ./configure
[root@host nghttp2]# make
[root@host nghttp2]# make install
[root@host nghttp2]# ldconfig
[root@host nghttp2]# cd ..

2、重新編譯curl命令:

[root@host root]# wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
[root@host root]# tar -zxvf curl-7.73.0.tar.gz
[root@host root]# cd curl-7.73.0/
[root@host curl-7.73.0]# ./configure --with-nghttp2=/usr/local --with-ssl --enable-tls-srp
[root@host curl-7.73.0]# make && make install
[root@host curl-7.73.0]# ldconfig
[root@host curl-7.73.0]# cd ..

3、確認系統的curl命令是否已經(jīng)支持HTTP2.0:

[root@host root]# curl --version

當看到有HTTP2 字樣,說(shuō)明已經(jīng)支持。

例如:

curl 7.73.0 (x86_64-pc-linux-gnu) libcurl/7.73.0 OpenSSL/1.0.2k-fips zlib/1.2.7 nghttp2/1.59.0-DEV
Release-Date: 2020-10-14
Protocols: dict file ftp ftps gopher http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

4、重新編譯PHP或直接升級PHP:

./upgrade.sh php

*需要注意的是,需要重新編譯、安裝之前已經(jīng)安裝了其他非自帶的擴展,例如:redis、GMP等,那你可能需要重新安裝這些擴展。

5、使用PHP探針或者PHP運行phpinfo();查看結果,如果安裝成功,您將會(huì )在“curl”模塊列表中看到HTTP2的狀態(tài)值為“Yes”。至此,您WEB環(huán)境的cUrl已經(jīng)支持HTTP2了。


本文版權所有,轉載須注明:來(lái)源  http://m.cheanjie.com/qvdv-zhuji-26.html