phpazure-web-app-serviceapcu

install apcu PHP extension in azure webapp linux container


I'm trying to start existing php application in azure App Service. Application is using apcu extension. I'm trying to istall extension to the app service. I connect via ssh and try to install the extension via

pecl install apcu

But I'm getting following error:

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

Solution

  • I think it's a bug in php 7.4 version. I switch it to 7.2 and 7.3, and it works for me.

    Tips

    If you insist on using version 7.4, you can try to install apcu and then switch the version back to 7.4. I haven't tested this solution with a project, it's just an alternative solution, I hope it helps you.

    You can raise a support ticket to confirm this.

    Change the php version to 7.2 or 7.3 first,

    and run command pecl install apcu . it works for me.

    Step 1. Change php version.

    enter image description here

    Step 2. Open SSH.

    enter image description here

    Step 3. Run command pecl install apcu

    enter image description here enter image description here