[英]pcre2.h: No such file or directory
我尝试在我的 mac 机器上安装openswoole
。 我在安装的时候遇到了这个问题。
/usr/local/Cellar/php@7.4/7.4.29/include/php/ext/pcre/php_pcre.h:25:10: fatal error: pcre2.h: No such file or directory
#include "pcre2.h"
我按照其他人的建议使用命令brew install pcre
来解决这个问题,但我总是得到相同的结果。 我尝试打开文件夹pcre
我只看到里面有一个php_pcre.h
文件。
尝试:
sudo ln -s /opt/local/include/pcre.h /usr/include/ "replace your file location here"
sudo pecl install apc
这是最简单的解决方案。 我终于解决了我的问题。 我使用 PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)
我的错误:致命错误:找不到“pcre2.h”文件
我使用的解决方案:
1. brew install pcre2
2. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/Cellar/php/8.1.7/include/php/ext/pcre/pcre2.h
Please check your path again when use `ln -s`
3. sudo pecl install ... something you want to install :) **openswoole** with you :).
安装成功:
希望它对你有帮助:) 谢谢
对于 M1 MacBooks,这就是我在安装 rdkafka 时修复该错误的方法。
pecl install rdkafka
错误
/Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
解决方案
ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/pcre2.h
查看新链接
➜ cd /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre
➜ ls -l
total 8
lrwxr-xr-x 1 ddhondup admin 48 Oct 6 15:29 pcre2.h -> /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h
-rw-rw-r-- 1 ddhondup admin 3970 Oct 1 2021 php_pcre.h
添加链接后,它起作用了。
Build process completed successfully
Installing '/Applications/MAMP/bin/php/php8.0.8/lib/php/extensions/no-debug-non-zts-20200930/rdkafka.so'
install ok: channel://pecl.php.net/rdkafka-6.0.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=rdkafka.so" to php.ini
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.