Раздел вопрос-ответ Install APCu on MacOS for PHP 8.2

How to install APCu ext for macOS Sonoma 14.0

I have Apple Silicon (M1) if it matters.

share

1 ответ

To install APCu via pecl, run command:

pecl install apcu

pecl install apcu

...

In file included from /private/tmp/pear/temp/apcu/apc_iterator.h:26:
/opt/homebrew/Cellar/php/8.2.9/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [php_apc.lo] Error 1
ERROR: `make' failed

What if you have an error "fatal error: 'pcre2.h' file not found" within apcu installation? 

Make sure you have installed pcre2:

 % brew install pcre2
Warning: pcre2 10.42 is already installed and up-to-date.

Try apcu installation again. If installation still fails with error "pcre2.h file not found" we need to provide correct path pcre2.h for PHP.

Let's look for pcre2.h source file in our system:

% locate pcre2.h
/opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h
/opt/homebrew/Cellar/pcre2/10.42/share/doc/pcre2/html/pcre2.html
/opt/homebrew/include/pcre2.h

And then add symlink to folder with your PHP version e.g. /opt/homebrew/Cellar/php/8.2.9/include/php/ext/p

cre/:

ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/8.2.9/include/php/ext/pcre/pcre2.h

After that, you should be able to install your required ext:

pecl install apcu

Добавить комментарий
    как минимум 5 символов

    icon Вход в систему

    зарегистрироваться
    НОВЫЕ ПОЛЬЗОВАТЕЛИ