How to Install PHP APC on Fedora & CentOS

APC (or Alternate PHP Cache) is a popular PHP PECL extension that can be used for PHP op-code caching. It is very stable and can significantly reduce page rendering times. It works by caching the PHP binaries, so that PHP doesn’t have to compile them on every request.

Installation is simple:

1. Use yum to install necessary packages.

# yum install php-pear php-devel httpd-devel pcre-devel

2. Use pecl to install the PECL apc package.

# pecl install apc

3. Create a config file that will be included in the PHP ini settings, which will load the APC binary. The default settings should be sufficient for most.

# echo "" > /etc/php.d/apc.ini

4. Restart Apache:

# service httpd restart

5. Make sure it works by creating a phpinfo.php with the following code and then accessing it in your browser. If it works correctly, there will be a new APC section.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>