linux服务器安装swoole扩展

说明:

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

 

猜你喜欢

转载自blog.csdn.net/u010071211/article/details/81082608
今日推荐