|The instructions provided in this article or section are considered advanced.|
You are expected to be knowledgeable in the UNIX shell.
Alternative PHP Cache (APC) is an open source framework for both optimizing and caching intermediate PHP code. It is currently supported by PHP.net (the developers of PHP).
APC provides support for all versions of PHP until version 5.5, after which Zend OPcache is a built in replacement.
DreamHost does not support versions of PHP lower than 5.5. It's only recommended to use PHP 5.5 or above and OPcache.
- Log into your server via SSH. The following commands can be ran in your user’s directory.
Note: This example uses PHP 5.4. Adjust the version number accordingly.
- Grab the source code:
- For a list of all versions, visit http://pecl.php.net/package/APC.
- Unpack the download:
tar xvf APC-3.1.13.tgz
- Change your directory to the one you just unpacked called /APC-3.1.13
- Run phpize. For PHP 5.4 domains:
- Run the following for a domain running PHP 5.4.
./configure --with-php-config=/usr/local/php54/bin/php-config; make
- Copy modules/apc.so file to your user’s directory:
cp ~/APC-3.1.13/modules/apc.so $HOME
- Create a custom PHP.ini.
- Add the following line to your phprc file:
extension = /home/USERNAME/apc.so
- Kill off all running PHP processes. The following article explains how depending on the version of PHP you’re using:
Confirming APC is functioning
APC is now installed and available to use. To confirm, add a phpinfo.php file to your site and view it online.
You can also copy apc.php from your unpacked download folder to a location on your site visible from the Internet. Then, simply go to the apc.php page from any web browser to see the reports.
Q: I've done all the above and APC still doesn't work.
A: Your PHP processes most likely have not been killed off after updating your phprc file. Visit the following article that explains how to kill off running PHP processes: