Installing APC (Alternative PHP Cache) on CentOS 5.6

There were more than a few instructions on how to do this. They were all wrong, at least for my default install of CentOS 5.6.

In a nutshell, here is how I was able to do it:

cd /tmp
yum install pcre-devel
tar -xvf APC-3.1.9.tgz
cd APC-3.1.9
whereis php-config
./configure –enable-apc –enable-apc-mmap –with-apxs –with-php config=/path/to/php-config
make install
echo "" >> /etc/php.d/apc.ini
echo "apc.slam_defense=0" >> /etc/php.d/apc.ini
echo "apc.write_lock=1" >> /etc/php.d/apc.ini
service httpd restart

I also make these changes to my httpd.conf file

Timeout 40
KeepAlive On
MaxKeepAliveRequests 200
KeepAliveTimeout 2


  1. Thank you for the post. I was able to easily APC working on 5.6. One problem though. WordPress messes up the hyphens in your post for this line:

    ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php config=/path/to/php-config

    The first hyphen needs to be two hyphens and I had to retype all of the hyphens to get the code to work. Hopefully this helps someone else.

    Thanks again!

Comments are closed.