1.下载及安装
### 下载最新安装包
curl -o /root/swoole.tar.gz https://github.com/swoole/swoole-src/archive/master.tar.gz -L
### 解压
tar zxvf /root/swoole.tar.gz
### 打开swoole目录
cd /root/swoole-src-master
### 搜索phpize php-config
find / -name phpize
### 配置
/usr/local/lnmp/php/bin/phpize && \
./configure \
--with-php-config=/usr/local/lnmp/php/bin/php-config \
--enable-sockets \
--enable-openssl \
--enable-http2 \
--enable-mysqlnd
### 编译及安装
make clean && make && sudo make install
### 修改php.ini文件
extension=swoole.so
### 官方编译参考
https://wiki.swoole.com/wiki/page/6.html
### 官方编译参数介绍
https://wiki.swoole.com/wiki/page/437.html
2.报错解决
### 报错error "Enable http2 support, require nghttp2 library.
### 下载
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
### 或者
yum -y install nghttp2