How to install APC (PHP Cache)
What is APC?
APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.
Install instructions
- Login to the server as root
- Download APC
- Extract and move into the directory
- Locate where php is
- Create configuration files
- Compile APC
- Install APC into php.ini
- Restart Apache
wget http://pecl.php.net/get/APC-3.0.14.tgz
gzip -d APC-3.0.14.tgz
tar -xf APC-3.0.14.tar
cd APC-3.0.14
which php
This should return something like: /usr/local/bin/php
We have to remember the location of php
phpize
./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
make
make install
The “make install” commnand will return the location of the apc.so extention please note the location. You will need this later.
You will have to first locate php using the locate command
locate php
This will usualy return /usr/local/Zend/etc/php.ini on a server that has Zend optimizer installed.
Now we will edit php.ini and add the APC extension.
pico /usr/local/Zend/etc/php.ini
Scroll down to the buttom and add the fallowing before the lines about the zend optimizer (They start with [Zend])
extension=”/apc_location/apc.so”
If you done everything it’s time to restart Apache
service httpd restart
Hope this helps !
If you enjoyed this post, make sure you subscribe to my RSS feed!
- September 7th


(1 votes, average: 4 out of 5)














For others who found this as easy to use as I did, a couple of notes.
If your running suPHP like I am, then leave out –with-apxs.
Also, don’t try to copy and paste this on the terminal line. Each one of the above dashes is actually two dashes - - together. It just doesn’t copy/paste well
Thanks for the informative article!
Hi Eric
You say to leave out -with-apxs when running suphp
I did that, but found that APC isn’t caching very many files, infact, only 16 on my entire web server
If I switch the php handler to DSO, or FCGI however, that figure rises quite dramatically
Have you managed to get apc working properly with suphp? If so, could you post how you did it?