去官网下载,官网:https://pecl.php.net/package/swoole
wget https://pecl.php.net/get/swoole-4.6.6.tgz
解压并进入到swoole目录
tar xf swoole-4.6.6.tgz cd swoole-4.6.6.tgz
安装依赖
yum install libevent libevent-devel -y
编译参数
./configure --enable-openssl --enable-http2 --enable-mysqlnd --enable-sockets --with-php-config=/usr/local/php/bin/php-config
安装
make && make install //安装成功后会有一个目录地址,用于配置php.ini
配置php.ini,在文件里搜索extension,增加一下面两句
extension_dir = /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/ extension = swoole.so
重启php