当前位置:论坛首页 > 新功能建议 > Linux面板

curl 不支持http2

发表在 新功能建议2021-5-16 10:28 [复制链接] 5 3989

安装php时开启的curl扩展没有支持http/2,在发送调用一些必须以http/2才能请求的接口会出现异常情况。建议在默认开启curl 的 http/2
使用道具 举报 只看该作者 回复
发表于 2021-5-19 15:01:12 | 显示全部楼层
本帖最后由 gaoxu529 于 2022-3-25 11:12 编辑

目前通过以下步骤已解决。

1. 获取punum ,后面要用到

  1. cat /proc/cpuinfo |grep "processor"|wc -l
复制代码


2. 下载nghttp2 源码


  1. wget -O nghttp2-1.42.0.tar.gz https://github.com/nghttp2/nghttp2/archive/refs/tags/v1.42.0.tar.gz
复制代码


3. 编译nghttp2

  1. tar -zxf nghttp2-1.42.0.tar.gz
  2. cd nghttp2-1.42.0
  3. rm -rf /usr/local/nghttp2
  4. autoreconf -i
  5. automake
  6. autoconf
  7. ./configure --prefix=/usr/local/nghttp2
  8. make clean
  9. make -j ${cupnum}
  10. make install
复制代码


4、下载curl源码

  1. wget https://download.bt.cn/src/curl-7.70.0.tar.gz
复制代码


5、编译curl

  1. tar -zxf curl-7.70.0.tar.gz
  2. cd curl-7.70.0
  3. rm -rf /usr/local/curl
  4. ./configure --prefix=/usr/local/curl --enable-ares --without-nss --with-ssl=/usr/local/openssl --with-nghttp2=/usr/local/nghttp2
  5. make -j${cpunum}
  6. make install
复制代码

6、卸载并重新安装php



使用道具 举报 回复 支持 反对
发表于 2022-1-7 22:54:51 | 显示全部楼层
楼主还在吗,按楼主的方法多次尝试后,还是无法启用http2
使用道具 举报 回复 支持 反对
发表于 2022-3-25 11:20:55 | 显示全部楼层
bylii 发表于 2022-1-7 22:54
楼主还在吗,按楼主的方法多次尝试后,还是无法启用http2

有报错信息吗
使用道具 举报 回复 支持 反对
发表于 2022-3-25 11:36:26 | 显示全部楼层
t

还在么,这个问题有解决方案么?  发表于 2023-4-15 10:12
使用道具 举报 回复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

企业版年付运维跟进群

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急问题处理

论坛响应时间:10分钟

问题处理方式:1对1处理(优先)

工作时间:白班:9:00 - 18:00

工作时间:晚班:18:00 - 24:00

立即付费处理
快速回复 返回顶部 返回列表