Alternative PHP Cache (APC) on Debian
February 2nd, 2006[Update, March 9th: Be sure to read the comments!]
The Alternative PHP Cache is a great way to improve the performance of webservers. I just finished installing it on mokey the server that runs this site and a number of others, primarily because of our increased use of a content management system called eZpublish which is very powerful, but also very memory hungry. There is no Debian package at the moment, so here is how I installed APC:
- Download APC:
cd /usr/local/src
wget http://pecl.php.net/get/APC-3.0.8.tgz - Extract the archive:
tar -xvvzf APC-3.0.8.tgz - Install php and apache development files:
sudo apt-get install apache-dev php4-dev(if you have apache2 it’s apache2-dev)
- Run these commands:
phpize
export CPPFLAGS="-I/usr/include/apache-1.3 -DAPC_PHP4_STAT"
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-configFor apache2 the last line becomes:
./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/bin/apxs2 --with-php-config=/usr/bin/php-config - Build it!
make
sudo make install - Finally, add this line to the bottom of your /etc/php4/apache/php.ini (or /etc/php/apache2/php.ini)
extension=apc.so
Good luck, and leave a comment or contact me if you have any problems. If you don’t feel comforable installing apc yourself contact me and I may be able to help.
