Php: Installing APC fails

Created on 17 Feb 2015  路  12Comments  路  Source: docker-library/php

I've tried to install apc in a php:5.6-apache container through pecl install apc, but it failed with the following error:

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/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/APC/apc.c -o a
pc.lo
mkdir .libs
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -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/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
/tmp/pear/temp/APC/apc.c: In function 'apc_search_paths':
/tmp/pear/temp/APC/apc.c:352:55: warning: passing argument 2 of 'php_stream_locate_url_wrapper' from incompatible pointer type
     wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC);
                                                       ^
In file included from /usr/local/include/php/main/php.h:398:0,
                 from /tmp/pear/temp/APC/apc.h:61,
                 from /tmp/pear/temp/APC/apc.c:34:
/usr/local/include/php/main/php_streams.h:549:28: note: expected 'const char **' but argument is of type 'char **'
 PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC);
                            ^
/tmp/pear/temp/APC/apc.c:416:20: warning: assignment discards 'const' qualifier from pointer target type
         exec_fname = zend_get_executed_filename(TSRMLS_C);
                    ^
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/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/APC/php_apc.c 
-o php_apc.lo
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -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/APC/php_apc.c  -fPIC -DPIC -o .libs/php_apc.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/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/APC/apc_cache.
c -o apc_cache.lo
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -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/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/tmp/pear/temp/APC/apc_cache.c: In function '_apc_cache_user_update':
/tmp/pear/temp/APC/apc_cache.c:818:63: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
             switch(Z_TYPE_P((*slot)->value->data.user.val) & ~IS_CONSTANT_INDEX) {
                                                               ^
/tmp/pear/temp/APC/apc_cache.c:818:63: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/APC/apc_cache.c:820:22: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
                 case IS_CONSTANT_ARRAY:
                      ^
Makefile:186: recipe for target 'apc_cache.lo' failed
make: *** [apc_cache.lo] Error 1
ERROR: `make' failed

So what is the correct way to get APC in your PHP container?

Most helpful comment

The (last) version 5.1.2 of APCu doesn't support PHP5 (only PHP7) so you need to set a specific version instead of beta tag :

RUN pecl install apcu-4.0.11 \
    && echo extension=apcu.so > /usr/local/etc/php/conf.d/apcu.ini

All 12 comments

I'm not sure what's causing your error, but a similar compilation error was reported for APCu here: https://github.com/krakjoe/apcu/issues/73

It looks like pecl install apc works against php:5.4-apache, but not php:5.5-apache or php:5.6-apache. Perhaps it's not compatible with PHP 5.6?

AFAIK, apc is no longer supported on PHP 5.5 and above. A quick search brought me to this;
http://grokbase.com/t/php/php-internals-win/145fj1qj14/compiling-memcache-and-apc-for-php-5-6, Which seems to confirm that it won't work.

As of PHP5.5, php has "opcache" built in; http://php.net/manual/en/intro.opcache.php. If you still need the "user cache" of APC, you may look at apcu, of use alternatives, such as memcached.

:+1: @thaJeztah

Yeah, it works with pecl install apcu-beta:

RUN pecl install apcu-beta \
    && echo extension=apcu.so > /usr/local/etc/php/conf.d/apcu.ini

The (last) version 5.1.2 of APCu doesn't support PHP5 (only PHP7) so you need to set a specific version instead of beta tag :

RUN pecl install apcu-4.0.11 \
    && echo extension=apcu.so > /usr/local/etc/php/conf.d/apcu.ini

Last Comment Has Worked For ME.........:)

PHP VERSIOn :5.6

Update:

pecl install apcu-4.0.11

install script even updates the php.ini as well!

@malsony - This worked perfectly for php-5.5 Thank you so much!

@FilicJD you're welcome!

Update:

pecl install apcu

This command will install the latest version and update the php.ini, too.

Si es en XAMPP Linux con PHP 5.6.23 (Puede ser que mayor)
$sudo /opt/lampp/bin/pecl install apcu-4.0.7
Y en el archivo php.ini
extension=apcu.so
Me gui茅 por la versi贸n actual de APCu en la p谩gina de PECL PHP
Regards :+1:

@lenybernard Thanks, it works for me

and php 7.3 ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmath10 picture cmath10  路  3Comments

2Kable picture 2Kable  路  3Comments

solocommand picture solocommand  路  3Comments

mcnesium picture mcnesium  路  3Comments

nojimage picture nojimage  路  3Comments