說明:
swoole只能用在LInux,macos系統上,不能用作Windows系統上
2.0.12版本開始不再支持PHP5
安裝方式一:pecl安裝
適用於php7.0以上版本
centOS中:
#pecl install swoole
報錯:-bash: pecl: command not found
解決:yum install php-devel php-pear
ubuntu中:
#pecl install swoole
報錯:No releases available for package "pecl.php.net/swoole"
解決:
#pear clear-cache
#pear update-channels
#pear upgrade
安裝方式二:編譯安裝
適用於php5.3以上版本
centOS中:
在此網站http://pecl.php.net/package/swoole選擇合適的版本,我用的是1.10.5
#wget http://pecl.php.net/get/swoole-1.10.5.tgz
#tar -zxvf swoole-1.10.5.tgz
#cd swoole-1.10.5
#phpize
#./configure
#make
#make install
在php.ini加入一行:extension=swoole.so
重啟apache,#systemctl restart httpd.service
通過php -m或phpinfo查看是否安裝成功
ubuntu中:
報錯:沒有phpize
解決:#sudo apt-get install php5.6-dev //我的是php5.6
其他同centOS類似
重啟apache,#/etc/init.d/apache2 restart
遇到的問題:在phpinfo中有在php-m中沒有
官網有解決辦法:https://wiki.swoole.com/wiki/page/351.html
