Centos – Failed to instal APC via pecl install APC

centoscentos5PHP

When I try to install APC via pecl install APC-3.1.5
or even pecl install APC I get following error when the package comes to the make command:

running: make
/bin/sh /var/tmp/pear-build-root/APC-3.1.5/libtool --mode=compile cc  -I. -I/var/tmp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.5/include -I/var/tmp/pear-build-root/APC-3.1.5/main -I/var/tmp/APC -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/APC/apc.c -o apc.lo
mkdir .libs
 cc -I. -I/var/tmp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.5/include -I/var/tmp/pear-build-root/APC-3.1.5/main -I/var/tmp/APC -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/tmp/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
In file included from /var/tmp/APC/apc.c:44:
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /var/tmp/APC/apc.c:44:
/usr/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre'
/var/tmp/APC/apc.c:369: error: expected specifier-qualifier-list before 'pcre'
/var/tmp/APC/apc.c: In function 'apc_regex_compile_array':
/var/tmp/APC/apc.c:430: error: 'apc_regex' has no member named 'preg'
/var/tmp/APC/apc.c:430: error: 'apc_regex' has no member named 'preg'
/var/tmp/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg'
/var/tmp/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg'
/var/tmp/APC/apc.c: In function 'apc_regex_match_array':
/var/tmp/APC/apc.c:463: error: 'apc_regex' has no member named 'preg'
/var/tmp/APC/apc.c:463: error: 'apc_regex' has no member named 'preg'
/var/tmp/APC/apc.c:464: error: 'apc_regex' has no member named 'nreg'
/var/tmp/APC/apc.c:464: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
ERROR: `make' failed

I installed all possible missing things:

yum install php-devel httpd-devel
yum groupinstall ‘Development Tools’
yum groupinstall ‘Development Libraries’

And still nothing.

Best Answer

Try

yum install pcre-devel

before installing APC.

On Debian use

aptitude install libpcre3-dev

instead.