PECL Alternative PHP Cache (APC) Installation

Time required: 1 minute

  1. Install APC using the PECL command (and skip to #5 if successful):
    # pecl install apc
  2. Or via compilation. Download the latest stable version and extract:
    # cd /usr/local/src && wget http://pecl.php.net/get/APC-3.0.19.tgz && tar -xzf APC-3.0.19.tgz && cd APC-3.0.19
  3. Note the paths returned for the following commands:
    # whereis php-config
    # whereis apxs
  4. Use the output from #2 to modify the –with-apxs and –with-php-config flags in the following compile command:
    # phpize && ./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/sbin/apxs --with-php-config=/usr/bin/php-config && make && make install

    The result should be similar to:

    Installing shared extensions: /usr/lib/php/modules/
  5. You can also use the apc.ini file we prepared for you:
    # cp /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/w3-total-cache/ini/apc.ini /etc/php.d/
  6. Restart apache when ready:
    # /etc/init.d/httpd restart
  7. You’re done! APC should now be available. If the following command retuns anything, you’re all set:
    # php -r 'phpinfo();' | grep 'apc'

For windows users we recommend checking the following site(s) for more installation tips:

( Ali Han, URI:alihan.com.tr/blog )


PECL Alternative PHP Cache (APC) Installation WordPress Theme
Reviewed by Ali Han on November 3rd 2010
Rating: 5