Fixing the "pcre2.h file not found" error when compiling a PHP PECL extension with brew

Published on 2024-11-29 • Modified on 2024-11-29

This snippet shows how to fix the «pcre2.h file not found» error when compiling a PHP PECL extension with brew. Replace both 10.44 and 8.4.1 with your current PCRE and PHP versions. Originally found on freek.dev 🙏.


brew install pcre2
ln -s/opt/homebrew/Cellar/pcre2/10.44/include/pcre2.h /opt/homebrew/Cellar/php/8.4.1/include/php/ext/pcre/pcre2.h

 More on Stackoverflow  More on the web  Random snippet

  Work with me!