APC

From DreamHost
(Redirected from Pecl APC)
Jump to: navigation, search
The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes performed by DreamHost may break your modifications. You, as the user, are responsible for troubleshooting and resolving issues with your customizations.

Overview

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 will be a built in replacement.

Installing APC

  1. Log into your server via SSH. The following commands can be ran in your user’s directory.
    Note2 icon.png Note: This examples uses PHP 5.4. Adjust the version number accordingly.


  2. Grab the source code:
    wget http://pecl.php.net/get/APC-3.1.13.tgz
  3. Unpack the download:
    tar xvf APC-3.1.13.tgz
  4. Change your directory to the one you just unpacked called /APC-3.1.13
  5. Run phpize. For PHP 5.4 domains:
    /usr/local/php54/bin/phpize
  6. Run the following for a domain running PHP 5.4.
    ./configure --with-php-config=/usr/local/php54/bin/php-config; make
    
  7. Copy modules/apc.so file to your user’s directory:
    cp ~/APC-3.1.13/modules/apc.so $HOME
    
  8. Create a custom PHP.ini.
  9. Add the following line to your phprc file:
    extension = /home/USERNAME/apc.so
  10. 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.

Troubleshooting APC

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:

See also