Jun 18th, 2009
Alternative PHP cache (APC)
Alternative PHP cache (APC)
Alternative PHP Cache (APC) is a PHP extension for caching data and compiled code from php accelerator. It helps to improve the performance of the webserver. The steps to install APC in cpanel are as follows:
Get the latest version of APC from http://pecl.php.net/package/APC
# wget http://pecl.php.net/get/APC-3.0.14.tgz
# tar -zxvf APC-3.0.14.tgz
# cd APC-3.0.14
You can find the path of phpize and php-config using which command.
#/usr/local/bin/phpize
#which php-config
#/usr/local/bin/php-config
Now use these details to complete installation.
# ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
# make
# make install
Add the following lines within the Dynamic Extensions section of php.ini as given below.
apc.shm_size = 32
After make install, you will get the extension path like this,
extension=”/usr/local/lib/php/extensions/no-debug-non-zts-20020429/apc.so”
confirm whether extension directory is defined in php.ini.
extension_dir = “/usr/local/lib/php/extensions/no-debug-non-zts-20020429″
If not you should give the full path in php.ini instead of just ‘extension=apc.so’. Like this,
extension=”/usr/local/lib/php/extensions/no-debug-non-zts-20020429/apc.so”
Restart httpd. Now you can see the apc section enabled in phpinfo() page.