编译安装swoole报错 "Enable http2 support, require nghttp2 library."

安装swoole时, 因为现在搭建环境的时候不会涉及到http2.0, 所以不会安装对应的依赖包, 会报出类似以下错误:

In file included from /root/build/swoole-src-master/swoole.c:16:0:
/root/build/swoole-src-master/php_swoole.h:143:2: error: #error "Enable http2 support, require nghttp2 library."
 #error "Enable http2 support, require nghttp2 library."

解决方法 安装 nghttp2:

# 如果 github 上有新版本的就下载安装新版的 #
wget https://github.com/nghttp2/nghttp2/releases/download/v1.34.0/nghttp2-1.34.0.tar.gz
tar zxvf nghttp2-1.34.0.tar.gz
cd nghttp2-1.34.0
./configure
make && make install

安装好 nghttp2,再次编译安装 swoole 即可。

评论