如何使用 PHP 7.4 安装 APCu

How to install APCu with PHP 7.4

我在配备 Apple M1 Max 芯片的 MacBook 上安装了 php 7.4 到 OSX 12.1。

我遵循了这条指示: https://getgrav.org/blog/macos-monterey-apache-mysql-vhost-apc

现在我尝试安装 APCu。但我收到此错误消息:

在 /private/tmp/pear/temp/apcu/php_apc.c:34 包含的文件中: 在 /private/tmp/pear/temp/apcu/apc_iterator.h:26 包含的文件中: /opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext/pcre/php_pcre.h:25:10: 致命错误: 'pcre2.h' 找不到文件 #include “pcre2.h” ^~~~~~~~~ 产生 1 个错误。 make: *** [php_apc.lo] 错误 1 错误:“制作”失败

我该如何解决这个问题?

感谢您的帮助。

我找到问题了。 Brew 将 pcre2 安装到另一个目录。 我用这个命令复制了文件,然后它起作用了:

cp /opt/homebrew/Cellar/pcre2/10.39/include/pcre2.h /opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext/pcre/