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

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

  1. 使用pecl安装
bash 复制代码
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. 试试源码编译安装呢
    下载源码地址
bash 复制代码
wget https://github.com/swoole/swoole-src/archive/refs/tags/v5.1.2.tar.gz

# 解压
tar zxvf swoole-src-5.1.2.tar.gz                                                             ✔  10354  14: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

着手解决这个异常

bash 复制代码
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官方文档

博客

相关推荐
mldong6 小时前
从 mldong 到 jeeflow:一个工作流引擎的独立进化
后端
陈随易7 小时前
MoonBit抓包模块pcap,查看电脑的每一次联网通信
前端·后端·程序员
Aaron - Wistron7 小时前
Web API C# (Furion版)带 单元测试
开发语言·后端·c#
卷无止境7 小时前
写代码这件事,到底该讲究点什么?
后端·python
卷无止境7 小时前
循环复杂度到底在算什么,Python 代码怎么才能写得让人一看就懂
后端·python
IT_陈寒9 小时前
Vite热更新失效?你可能漏了这个配置
前端·人工智能·后端
SomeB1oody10 小时前
【RustyML入门】1.0. 快速上手
开发语言·后端·机器学习·rust·教程
史呆芬11 小时前
分布式事务实战:微服务跨服务数据一致性解决方案
java·后端·spring cloud