在linux服务器上给php安装swoole扩展方法如下:
1、php5.56安装swoole扩展
wget https://github.com/swoole/swoole-src/archive/swoole-1.7.6-stable.tar.gz //php5.5.6
tar zxvf swoole-1.7.6-stable.tar.gz
cd swoole-1.7.6-stable
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
最后要修改下php.ini 添加extension = swoole.so
vim /usr/local/etc/php.ini
重启php-fpm
killall php-fpm && /usr/local/php/sbin/php-fpm
php -m查看有没有swoole即可
2、php7安装swoole扩展
wget https://github.com/swoole/swoole-src/archive/v1.9.1-stable.tar.gz //php7.1
tar zxvf v1.9.1-stable.tar.gz
cd swoole-src-1.9.1-stable
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config (/usr/local/php/bin/php-confi这个是自己PHP环境目录例如:./configure --with-php-config=/usr/local/anlewo/php71/bin/php-config)
make
make install
然后在php.ini配置扩展
extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/swoole.so"