Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pcre2.h: No such file or directory

I try to install openswoole on my mac machine. I have this issue when installing it.

/usr/local/Cellar/[email protected]/7.4.29/include/php/ext/pcre/php_pcre.h:25:10: fatal error: pcre2.h: No such file or directory
 #include "pcre2.h"

I used the command brew install pcre to fix this issue as others recommend, but I always get the same result. I try to open the folder pcre I only see one php_pcre.h file inside it.

like image 235
user3818576 Avatar asked Sep 10 '25 14:09

user3818576


2 Answers

Here's simplest solution. I have finally solved my problem. I used PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)

My errors: fatal error: 'pcre2.h' file not found

The solution that I used:

  1. brew install pcre2

  2. ln -s /opt/homebrew/opt/pcre2/include/pcre2.h /opt/homebrew/opt/[email protected]/include/php/ext/pcre/

    Beware of the PHP version in the destination, adjust as-needed. Then, re-run the installation that failed, e.g. apcu or openswoole.

  3. pecl install ...

Success Installation:

enter image description here

like image 58
Alex Avatar answered Sep 12 '25 05:09

Alex


try:

sudo ln -s /opt/local/include/pcre.h /usr/include/       "replace your file location here"
sudo pecl install apc 
like image 23
debugger Avatar answered Sep 12 '25 03:09

debugger