How To Install PHP Pecl for 5.3.x with APC Module

by Jon on August 17th, 2011

If you are looking to improve performance on your apache web server there is a PHP module that is from the PHP extension community library named Alternative PHP Cache. This APC module will cache and optimize your PHP webpages speeding up content delivery. Here are directions how to install this package.

This pecl installer will configure your apache installation automatically if you installed apache. Some problems can arise when installing usually due to missing packages, see an example of a missing package below.

/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /tmp/tmpia0OKv/APC-3.1.9/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'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:393: error: expected specifier-qualifier-list before 'pcre'
/tmp/tmpia0OKv/APC-3.1.9/apc.c: In function 'apc_regex_compile_array':
/tmp/tmpia0OKv/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c: In function 'apc_regex_match_array':
/tmp/tmpia0OKv/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg'
/tmp/tmpia0OKv/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
ERROR: `make' failed

If you come across this error then the make sure to install pcre and pcre-devel with yum.