php8.2 安装swoole扩展 (mac m1)

文章讲述了在PHP8.2环境中安装Swoole扩展时遇到的pcre2.h文件未找到的问题,作者首先尝试了使用pecl安装失败,然后转而从源码编译并解决了pcre2.h路径问题,最后成功安装了Swoole扩展。
摘要由CSDN通过智能技术生成

php8.2 安装swoole扩展 发现报错 此处记录

  1. 使用pecl安装
sudo  pecl install swoole
...
# 发现报错

/opt/homebrew/Cellar/php@8.2/8.2.15/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [ext-src//php_swoole.lo] Error 1
  1. 试试源码编译安装呢
    下载源码地址
wget https://github.com/swoole/swoole-src/archive/refs/tags/v5.1.2.tar.gz

# 解压
tar zxvf swoole-src-5.1.2.tar.gz                                                             ✔  1035414:51:06
cd swoole-src-5.1.2 && \
phpize && \
./configure && \
sudo make && sudo make install

# 发现报同样错
/opt/homebrew/Cellar/php@8.2/8.2.15/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [ext-src//php_swoole.lo] Error 1

着手解决这个异常

brew install pcre2
ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php@8.2/8.2.15/include/php/ext/pcre/pcre2.h

重新执行1

安装成功

参考链接

swoole官方文档

博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值