Installing Alternative PHP Cache (APC)
APC is the Alternative PHP Cache, which is a free, open, and robust framework for caching and optimizing PHP intermediate code. What this means is that APC reads your PHP files, parses them into a more efficient binary format and then caches them in memory so that each request for your PHP files and PHP library files can be fed from the parsed cache. This will generally lead to a speed increase when serving a PHP site, especially one with a lot of library files.
Alternative PHP Cache (APC) will be integrated by default on PHP6. Though this setting will default to off, APC’s caching can significantly increase the speed of your web application. There are currently some great PHP caching libraries available but integrated support can make the system run faster.
- To install it with the default CLI version of php, use the following:
tar xvzf APC-3.1.9.tgz
Here an error may appear:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
you can fix it with: yum -y install autoconf
2. Then, we needed to edit the php.ini to add the code:
3. service httpd restart
When you download and install the APC cache, there’s a file in the root level of the source archive called apc.php – this is a PHP script which allows you to view information about the status of the PHP Cache as shown in the screenshots below. You simply need to copy the apc.php file to a directory that is served by your Apache (or other) web server and then load up the page in your browser.