MAC安装swoole报错pcre2.h not found或ssl.h not found的解决方法

一、MAC安装swoole命令

pecl install swoole

二、解决ssl.h not found

如果报错ssl.h not found,解决方法如下:

pecl install swoole

enable sockets supports? [no]: yes

enable openssi support? [no]: yes --with-openssL-dir=/opt/homebrew/opt/openssl

其中的/opt/homebrew/opt/openssl改为你openssl的目录,请确认好。

三、解决pcre2.h not found

1、先安装pcre2

brew install pcre2

2、pcre软连接 

ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php@8.1/8.1.27_1/include/php/ext/pcre/pcre2.h

其中/opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h和/opt/homebrew/Cellar/php@8.1/8.1.27_1/include/php/ext/pcre/pcre2.h改为你的目录,请确认好。

四、确认pcre软连接是否成功

进入/opt/homebrew/Cellar/php@8.1/8.1.27_1/include/php/ext/pcre目录,

cd /opt/homebrew/Cellar/php@8.1/8.1.27_1/include/php/ext/pcre

看这个目录是否存在pcre2.h

ls

五、解决了上述错误后,重新安装swoole

pecl install swoole

等待安装,出现以下证明安装成功了

六、验证是否成功安装和启用swoole

php -m | grep swoole

执行以上命令,输出swoole,则证明已成功启用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值