CentOS – Install Alternative PHP Cache (APC)

Haven’t worked with CentOS for a long time. Miss the time and the teammates in HKU CECID.

Here are the steps to install Alternative PHP Cache (APC) on CentOS.
1. Install the following packages.

yum install php-pear php-devel httpd-devel pcre-devel gcc make


2. Install APC with PECL.

pecl install apc


3. You will be asked a few questions. Just use the default settings.

Enable internal debugging in APC [no]: 
Enable per request file info about files Used From The APC cache [no]: 
Enable spin locks (EXPERIMENTAL) [no]: 
Enable memory protection (EXPERIMENTAL) [no]: 
Enable pthread mutexes (default) [yes]: 
Enable pthread read / write locks (EXPERIMENTAL) [no]:


4. Include the APC extension in php.ini by creating the /etc/php.d/apc.ini.

echo "extension = apc.so" > /etc/php.d/apc.ini


5. Restart Apache.

/etc/init.d/httpd restart


6. Verify the installation in phpinfo().

Done =)

Reference: CentOS 6 – Install APC


4 thoughts on “CentOS – Install Alternative PHP Cache (APC)”

    1. Just help a fd to setup the server. the hosting company give me a CentOS~~ LoL

      I have a fd do some benchmarking on the Nginx and it’s really amazing on performance.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.