现在再宝塔中直接安装Swoole扩展,是4.2.10版本,但是这个版本有个bug,官方暂未解释。
swoole4.2.10 使用swoole_process报错,must be forked outside the coroutine
【后期修复文章,统一安装4.5.0版本,PHP需要使用7.3+以上版本】
所以我们安装4.5.0
,手动安装教程如下:
wget http://pecl.php.net/get/swoole-4.5.0.tgz
tar -zxvf swoole-4.5.0.tgz
cd swoole-4.5.0
phpize
./configure --with-php-config=/www/server/php/73/bin/php-config --enable-openssl
make
make install
# 修改php.ini,末尾加上下面这句
extension=swoole.so
保存,重启php服务器
php -m
查看扩展是否安装成功
如果你要自己指定openssl的地址,还可以在./configure
末尾,加上--with-openssl-dir=/usr/bin/openssl