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官方文档

博客

相关推荐
Warson_L7 分钟前
Python 流程控制与逻辑
后端·python
糖炒栗子03269 分钟前
架构笔记:应用配置无状态化 (Statelessness)
后端
Warson_L16 分钟前
Python 四大组合数据类型 (Collection Types)
后端·python
查古穆42 分钟前
大白话讲ReAct:大模型的“边想边干”
后端
于先生吖1 小时前
SpringBoot+MQTT 无人健身房智能管控系统源码实战
java·spring boot·后端
毕设源码-小云学姐1 小时前
计算机毕业设计springboot网上招聘系统 基于SpringBoot的在线人才对接平台设计与实现 SpringBoot框架下的数字化求职招聘服务系统开发
spring boot·后端·课程设计
weyyhdke3 小时前
springboot和springframework版本依赖关系
java·spring boot·后端
ywf12153 小时前
Go基础之环境搭建
开发语言·后端·golang
Victor3563 小时前
MongoDB(76)如何配置防火墙规则?
后端
Victor3563 小时前
MongoDB(75)如何配置TLS/SSL加密?
后端