Install mongodb extension on Mac M1

在 Mac M1 上安装 PHP 开发环境遇到的问题。

安装 mongodb 扩展:

pecl install mongodb

编译错误:

/opt/homebrew/Cellar/php/8.0.1_1/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found

解决方案:

ln -s /opt/homebrew/Cellar/pcre2/10.36/include/pcre2.h /opt/homebrew/Cellar/php/8.0.1_1/include/php/ext/pcre/pcre2.h

参考:

https://stackoverflow.com/questions/66496119/pecl-fails-installing-mongodb-driver-on-apple-silicon-m1

 421 total views,  2 views today