怎样安装PHP的swoole扩展

2017年4月18日 | 分类: 【技术】

【介绍】

官网:http://www.swoole.com/

文档:https://github.com/swoole/swoole-src

参考:http://www.cnblogs.com/piwefei/p/5620284.html
参考:https://segmentfault.com/a/1190000004122677
参考:https://www.iamle.com/archives/1989.html

【安装】

下载源码编译安装:

wget -c https://github.com/swoole/swoole-src/archive/swoole-1.7.21-stable.tar.gz && tar zxvf swoole-1.7.21-stable.tar.gz && cd swoole-src-swoole-1.7.21-stable/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

git下载源码编译安装:

git clone https://github.com/swoole/swoole-src.git && cd swoole-src
phpize
./configure
make && make install

如果没有安装phpize,执行命令安装:

yum install php-devel

成功编译后,输出:

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20151012/
Installing header files:           /usr/local/php/include/php/

【配置】

打开,/usr/local/php/etc/php.ini ,添加:

; [swoole]
extension = "swoole.so"

【查验】

php -m | grep swoole
/usr/local/php/bin/php -m | grep swoole

输出:

swoole

查看版本:

php --re swoole|grep VERSION

输出:

    Constant [ string SWOOLE_VERSION ] { 2.0.7 }