How to install PHP-APC in WHM/cPanel

 

If you are trying to install APC are not able to using the WHM PECL installer then try this. APC needs to be installed from source so these instructions assume you have root access to the server using a client like putty.

login to server as root and run the following commands:

 

cd ~ 
mkdir setups
cd setups 
wget http://pecl.php.net/get/APC-3.1.5.tgz 
tar -xvf APC-3.1.5.tgz 
cd APC-3.1.5
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php config=/usr/local/bin/php-config
make

 

If you face any kind of error like :- 

In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:52: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c:362: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_compile_array':
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_match_array':
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
Then you need to install pcre and make sure you do this from the / directory or it will not install.
yum install pcre-devel
Again do:
make
If no errors then do:
make install
update php.ini through WHM PHP Configuration Editor. Switch to Advanced and find Section:Core Directive:extension and add this to the end of the list:
, apc.so
Then restart apache and your done. the phpinfo function should show that APC is installed
 
Hope this helps someone.

 

 

 

2 Responses on this post

  1. You are a star. I used the latest stable version (3.1.9), and so substituted that in the instructions. The extensions box in the php conf editor was empty, so I omitted the preceding comma. Checked with phpinfo and there it is. Smiles.

  2. Woww man you rock.. Awesome blog. you saved my production environment. I really Appreciate for the contribution you have made.
    It installed with out any single error.

    Thanks Once again buddy.

    Ron

Leave a Reply

Your email address will not be published. Required fields are marked *