在 azure webapp linux 容器中安装 apcu PHP 扩展

install apcu PHP extension in azure webapp linux container

我正在尝试在 Azure 应用服务中启动现有的 php 应用程序。 应用程序正在使用 apcu 扩展名。 我正在尝试安装应用程序服务的扩展。 我通过 ssh 连接并尝试通过

安装扩展
pecl install apcu

但我收到以下错误:

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/bash /tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/libtool --mode=compile cc -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/apcu -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootdX8M2c/a
pcu-5.1.19/include -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/main -I/tmp/pear/temp/apcu -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/u
sr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/apcu/apc.c -o apc.lo
 cc -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/apcu -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/include -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/main -I/tmp
/pear/temp/apcu -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g
 -O2 -c /tmp/pear/temp/apcu/apc.c  -fPIC -DPIC -o .libs/apc.o
In file included from /tmp/pear/temp/apcu/apc.c:32:
/tmp/pear/temp/apcu/apc.h:64:10: fatal error: config.h: No such file or directory
 #include <config.h>
          ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:194: apc.lo] Error 1
ERROR: `make' failed

我认为这是 php 7.4 版本中的错误。我将其切换为 7.27.3,它对我有用。

小贴士

如果您坚持使用7.4版本,可以尝试安装apcu,然后将版本切换回7.4。我没有用项目测试过这个解决方案,它只是一个替代方案,我希望它能帮助你。

You can raise a support ticket to confirm this.

首先将php版本更改为7.27.3

和运行 命令pecl install apcu . 它对我有用。

步骤 1. 更改 php 版本。

步骤 2. 打开 SSH。

步骤3.运行命令pecl install apcu