APC cache is a PHP caching solution which stands for Alternative PHP Cache. It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.
The following are the steps to install APC cache on a cPanel / Plesk OR even on a plan CentOS server:
1) SSH to your server and go to a temporary directory
# cd /usr/local/src
2) Download the latest APC version
# wget http://pecl.php.net/get/APC-3.1.6.tgz
3) Unpack the version and change to the APC directory
# tar -zxf APC-3.1.6.tgz
# cd APC-*
4) Create configuration files
# phpize
5) Search for the “php-config” file since you need to configure APC with it
# which php-config
6) Now, configure APC
# ./configure --enable-apc --enable-apc-mmap --with-apxs\ --with-php-config=/usr/local/bin/php-config
7) Create the installation files and install APC
# make
# make install
Now that the APC cache is installed on your server, the final step is to activate the APC extension in the php.ini file.
Locate the working php.ini file of your server
# php -i | grep php.ini
edit the file and search for “extension_dir” and place the following code below it (tweak the values as per your requirement):
extension="apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=256
apc.ttl=3600
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXX
apc.enable_cli=1
Restart the Apache web server for changes to take affect. To confirm if APC is activated, execute
# php -i | grep apc
Note: once APC is installed, make sure the ‘apc.so’ file is created under the directory specified at the “extension_dir” in php.ini. If not, look for the exact path of the file and create a symlink under it.
December 20th, 2010 at 10:34 pm
Hello,
I’m trying to update my APC version to 3.1.6, but all I did not work.
My actual version is 3.0.19.
How can I do to update that?
December 21st, 2010 at 10:03 am
Hi Andre, You need to download the latest version i.e. 3.1.6 and install it with the steps provided above. To avoid any confusion, remove the older version first by going to the APC directory and executing,
December 21st, 2010 at 11:33 am
Hello,
Thank you for reply me!
Could you explain to me how can I do it?
Step by step?
For example: How do I need to go into APC directory?
Is just writing: cd APC-*
I’m sorry, but I don’t have much knowedge about ssh and apc.
Again, thank you!!
December 21st, 2010 at 8:00 pm
Hi,
I tried to do all steps you tell me.
But it does not work.
Have any mode to auto update via ssh?
Any code to use?
Thank you!
December 22nd, 2010 at 9:03 am
Andre, you need to perform the steps I have given you in the previous comment first before installing the latest version. The 2 steps forwarded above has to be executed in the older version APC directory you downloaded. If you wish, you can contact me over MSN or via email and I will help you out.