安装mongodb
安装的: mac m1且php版本是7.4.30
安装的时候报错:
mp/pear/temp/mongodb/src/contrib/ -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/mongodb/php_phongo.c -fno-common -DPIC -o .libs/php_phongo.o
In file included from /private/tmp/pear/temp/mongodb/php_phongo.c:29:
In file included from /opt/homebrew/Cellar/php@7.4/7.4.30_1/include/php/ext/spl/spl_iterators.h:24:
/opt/homebrew/Cellar/php@7.4/7.4.30_1/include/php/ext/pcre/php_pcre.h:25:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
在mac中搜索pcre2.h文件的位置复制一份
执行命令如下:
cp /opt/homebrew/Cellar/pcre2/10.4/include/pcre2.h /opt/homebrew/Cellar/php\@7.4/7.4.40/include/php/ext/pcre/pcre2.h
随后执行命令
pecl install mongodb
提示安装成功即可
版权声明:本文为whistlegirl原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。