[英]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.