我的php是通过brew安装的,设计目录/版本部分记得修改
pecl install swoole
如果安装过程中提示错误pcre2.h not found,则需要添加软连接,代码如下
ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/Cellar/php@7.4/7.4.28/include/php/ext/pcre/pcre2.h
检测:
php -m | grep swoole
安装其他版本,首先卸载swoole,同时记得将php.ini中的swoole关闭,以4.5为例
pecl uninstall swoole pecl install
https://pecl.php.net/get/swoole-4.5.0.tgz