Cain Manor

Your Guide To All Things Cain™

Installing APC (Alternative PHP Cache) on CentOS 5.6

There were more than a few instruc­tions on how to do this. They were all wrong, at least for my default install of Cen­tOS 5.6.

In a nut­shell, here is how I was able to do it:

cd /tmp
yum install pcre-devel
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xvf APC-3.1.9.tgz
cd APC-3.1.9
phpize
whereis php-config
./configure –enable-apc –enable-apc-mmap –with-apxs –with-php config=/path/to/php-config
make
make install
echo "extension=apc.so" >> /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

2 Comments

  1. Thank you for the post. I was able to eas­ily APC work­ing on 5.6. One prob­lem though. Word­Press 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. Hope­fully this helps some­one else.

    Thanks again!

  2. Thx, it helped me!