shivammathur / homebrew-php

:beer: Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.

Home Page:https://github.com/shivammathur/homebrew-php/packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PCRE2 header file not found

alexander-schranz opened this issue · comments

Describe the bug

PCRE2 header file not found when installing

PHP versions

8.0.12

To Reproduce

brew install shivammathur/php/php@8.0
pecl install apcu
# same for pecl install pcov or imagick

Expected behavior

Screenshots/Logs

==> Downloading https://ghcr.io/v2/homebrew/core/pcre/manifests/8.45
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/4a3bba0e8d1899c13ac3442d2c49df6c1999948bdc0943f2f179693257d82545--pcre-8.45.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pcre/blobs/sha256:11193fd0a113c0bb330b1c2c21ab6f40d225c1893a451bba85e8a1562b914a1c
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/170438f14a8f71c2014f4153809a324710497480dd8d02225a6f11ffca881530--pcre--8.45.arm64_monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.39
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/d04cf1b7feb00f01719e307014af7b7e0bdd32565eb226a2782f259934e3fe9b--pcre2-10.39.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:f0633818b37d8d3ce88c882e048ada77e58f1f445a41e35b028d23e8866fc5ab
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/ffdc5d23f3013e54dd464f4ff9a6878db96727d2ce0bb87542cc0efc86df77c1--pcre2--10.39.arm64_monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/shivammathur/php/php/manifests/8.0.12
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/e7460bd85566cddb5c600476ff4e3307d7ac66f5b57e2f628b8fd0e18342800a--php-8.0.12.bottle_manifest.json
==> Downloading https://ghcr.io/v2/shivammathur/php/php/blobs/sha256:5183936efd4ed4db35cd69474597d1cb03e306f28176450bb7cffed2883dc8ef
Already downloaded: /Users/alexanderschranz/Library/Caches/Homebrew/downloads/6b5e531e71a614294fc1ae4f0cac55163b8f189c622c3079a3b016f5ef23a112--php--8.0.12.arm64_big_sur.bottle.tar.gz
==> Installing php from shivammathur/php
==> Installing dependencies for shivammathur/php/php: pcre and pcre2
==> Installing shivammathur/php/php dependency: pcre
==> Pouring pcre--8.45.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre/8.45: 204 files, 4.6MB
==> Installing shivammathur/php/php dependency: pcre2
==> Pouring pcre2--10.39.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre2/10.39: 230 files, 6.0MB
==> Installing shivammathur/php/php
==> Pouring php--8.0.12.arm64_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set php_ini /opt/homebrew/etc/php/8.0/php.ini system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set php_dir /opt/homebrew/share/pear system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set doc_dir /opt/homebrew/share/pear/doc system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set ext_dir /opt/homebrew/lib/php/pecl/20200930 system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set bin_dir /opt/homebrew/opt/php/bin system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set data_dir /opt/homebrew/share/pear/data system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set cfg_dir /opt/homebrew/share/pear/cfg system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set www_dir /opt/homebrew/share/pear/htdocs system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set man_dir /opt/homebrew/share/man system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set test_dir /opt/homebrew/share/pear/test system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear config-set php_bin /opt/homebrew/opt/php/bin/php system
==> /opt/homebrew/Cellar/php/8.0.12/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /opt/homebrew/etc/php/8.0/

To restart shivammathur/php/php after an upgrade:
  brew services restart shivammathur/php/php
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/php/sbin/php-fpm --nodaemonize
==> Summary
🍺  /opt/homebrew/Cellar/php/8.0.12: 500 files, 78.0MB
==> Caveats
==> php
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /opt/homebrew/etc/php/8.0/

To restart shivammathur/php/php after an upgrade:
  brew services restart shivammathur/php/php
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/php/sbin/php-fpm --nodaemonize
alexanderschranz@MacBook-Pro-von-Alexander ~ % pecl i
alexanderschranz@MacBook-Pro-von-Alexander ~ % php -v
PHP 8.0.12 (cli) (built: Oct 21 2021 00:21:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.12, Copyright (c), by Zend Technologies
alexanderschranz@MacBook-Pro-von-Alexander ~ % pecl install pcov
downloading pcov-1.0.9.tgz ...
Starting to download pcov-1.0.9.tgz (25,201 bytes)
.........done: 25,201 bytes
16 source files, building
running: phpize
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930
configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
build/php.m4:2072: PHP_CONFIG_NICE is expanded from...
configure.ac:18: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build/libtool.m4:561: _LT_AC_LOCK is expanded from...
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
build/libtool.m4:561: _LT_AC_LOCK is expanded from...
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2728: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2727: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_CPLUSPLUS' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1185: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2810: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2809: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1918: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
building in /private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9
running: /private/tmp/pear/temp/pcov/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... no
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... arm-apple-darwin21.1.0
checking host system type... arm-apple-darwin21.1.0
checking target system type... arm-apple-darwin21.1.0
checking for PHP prefix... /opt/homebrew/Cellar/php/8.0.12
checking for PHP includes... -I/opt/homebrew/Cellar/php/8.0.12/include/php -I/opt/homebrew/Cellar/php/8.0.12/include/php/main -I/opt/homebrew/Cellar/php/8.0.12/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.12/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/php/8.0.12/pecl/20200930
checking for PHP installed headers prefix... /opt/homebrew/Cellar/php/8.0.12/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable php coverage support... yes, shared
checking PHP version... 7.4+
checking for a sed that does not truncate output... /usr/bin/sed
checking for ld used by cc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 786432
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin21.1.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/pcov -I/private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9/include -I/private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9/main -I/private/tmp/pear/temp/pcov -I/opt/homebrew/Cellar/php/8.0.12/include/php -I/opt/homebrew/Cellar/php/8.0.12/include/php/main -I/opt/homebrew/Cellar/php/8.0.12/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.12/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext/date/lib -I/private/tmp/pear/temp/pcov/cfg/704  -DHAVE_CONFIG_H  -g -O2   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /private/tmp/pear/temp/pcov/pcov.c -o pcov.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/pcov -I/private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9/include -I/private/tmp/pear/temp/pear-build-alexanderschranzsZAu3C/pcov-1.0.9/main -I/private/tmp/pear/temp/pcov -I/opt/homebrew/Cellar/php/8.0.12/include/php -I/opt/homebrew/Cellar/php/8.0.12/include/php/main -I/opt/homebrew/Cellar/php/8.0.12/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.12/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext -I/opt/homebrew/Cellar/php/8.0.12/include/php/ext/date/lib -I/private/tmp/pear/temp/pcov/cfg/704 -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /private/tmp/pear/temp/pcov/pcov.c  -fno-common -DPIC -o .libs/pcov.o
In file included from /private/tmp/pear/temp/pcov/pcov.c:26:
/opt/homebrew/Cellar/php/8.0.12/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [pcov.lo] Error 1
ERROR: `make' failed

Additional context

Apple M1 Silicon ARM based.

Also --build-from-source didn't work.

Are you willing to submit a PR?

I think the formular looks correct. Not sure why this error happens for me.

Workaround

# php 8
ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/opt/php@8.0/include/php/ext/pcre/pcre2.h
# php 7.4
ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/opt/php@7.4/include/php/ext/pcre/pcre2.h
# php 7.2
ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/opt/php@7.2/include/php/ext/pcre/pcre2.h

Not sure why the pcre2.h is not there or why it can not be found?

I would recommend using shivammathur/extensions tap for installing extensions.

But if you want to use pecl, you will have to copy the pcre2.h to php's include directory. This workaround is required since the macOS sdk changes in macOS Catalina.

pcre2_h="$(find "$(brew --cellar pcre2)" -name "pcre2.h")"
cp -f "$pcre2_h" "$(brew --cellar php)"/*/include/php/ext/pcre

But you will have to do this after every PHP release or if you switch PHP version.

@shivammathur Thx for the fast response. I will have a look also at the extension brew tap.