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 "extension=apc.so" > /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.