免费1级做爰网站,app 门户网站,seo搜索引擎优化排名,贵阳网络推广公司有哪些由于宝塔面板默认的php编译的curl未加入http2的支持#xff0c;如果服务需要使用apns推送等需要http2.0的访问就会失败#xff0c;所以重新编译php让其支持http2.0
编译方法#xff1a;
一、安装nghttp2
git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp…由于宝塔面板默认的php编译的curl未加入http2的支持如果服务需要使用apns推送等需要http2.0的访问就会失败所以重新编译php让其支持http2.0
编译方法
一、安装nghttp2
git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
make install
echo /usr/local/lib /etc/ld.so.conf.d/custom-libs.conf
ldconfig#查看nghttp2版本 测试时安装1.19.0版本顺利通过
nghttpx -V注意新版本的nghttp2需要python3.8以上版本 如果系统未安装phthon3.8以上版本的请先行安装安装方法如下
1、下载安装包以python3.8.8为例
wget https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz
tar -zxvf Python-3.8.8.tgz2、编译安装Python
mkdir /usr/local/python3 #创建编译安装目录
cd Python-3.8.3
./configure --prefix/usr/local/python3
make make install
3、建立软链接未完成这一步会找不到python3#添加python3的软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python二、安装Curl
curl可以通过官网或github下载 github: https://github.com/curl/curl/releases 官网: https://curl.haxx.se/download/curl-7.70.0.tar.gz
wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
tar -zxf curl-7.73.0.tar.gz
cd curl-7.73.0
rm -rf /usr/local/curl
./configure --prefix/usr/local/curl --enable-ares --without-nss --with-ssl/usr/local/openssl --with-nghttp2/usr/local/nghttp2/#配置时可以看到nghttp2 enable就说明是已经开启
make
make install#删除安装包可选
- cd ..
- rm -f curl-7.73.0.tar.gz
- rm -rf curl-7.73.0#查看版本是否正确
- curl -V
curl 7.73.0 (x86_64-pc-linux-gnu) libcurl/7.73.0 OpenSSL/1.0.2k-fips zlib/1.2.7 nghttp2/1.40.0
Release-Date: 2020-10-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets
#看到http2是说明安装正常三、安装完成后在宝塔后台重新编译PHP
编译时最好是选择下自定义模块增加以下参数
--with-curl/usr/local/bin/curlphp -r phpinfo(); | grep HTTP2
HTTP2 Yes大功告成
总结
安装时遇到一个问题就是curl版本跟php版本有对应关系。如果版本不对应即使curl编译成功并且也支持http2但是编译php之后不生效。具体版本对应关系目前不太清楚。安装中测试了如下关系。 php7.3 curl 7.73.0 启用成功 php7.4 curl 7.74.0 启动不生效 php7.0 7.2 7.3 7.4 curl 7.68.0 7.70.0均不生效。 据此推测应该php7.4 需要更高一些的curl版本才行。有空后期再试试。