How to install Alternative PHP Cache (APC) on Server

May 13, 2011 / Virtual Server

Installing APC on your Virtual Private Server

The APC-Alternative PHP Cache is a free, open, and robust framework that is responsible for caching and optimization of PHP.

Steps to Install APC on your web server

Step i – You must be logged in as root to proceed with installing APC on your server

Step ii – You must then download the APC

wget http://pecl.php.net/package/APC

eg : wget http://pecl.php.net/get/APC-3.0.15.tgz

Step iii – Having done that, you are then required to extract it over your Web Hosting UK server:

tar -xzf APC-3.0.15.tgz

cd APC*

Step iv – Look for the PHP location by running the below command :

which php

You must remember the location displayed in the result.

Step v – Now you need to proceed with creating the configuration files using the below command :

phpize

Step vi – Now the APC need to be compiled over the server :

./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
make
make install

Note: You must install the APC in the php.ini file

Step vii – Run the below command to find the php.ini over the server :

php -i | grep php.ini

Step viii – Amend php.ini by adding APC extension, as stated below :

vi /usr/local/Zend/etc/php.ini

Step ix – Add the following to the php.ini file :

apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

Step x – Finally, you must restart Apache using the below command :

service httpd restart

If you need any assistance with that, please contact our technical support department via. 24×7 Live Chat or raise a ticket via. our helpdesk

 

Spread the love