Install APC extension for PHP from sources

How to compile the PHP APC extension for your PHP version

Used operating system: Ubuntu 14.04

There are few steps to follow until you will have your APC extension up and running for your particular PHP version:

  • Download the latest version of APC
  • wget http://pecl.php.net/get/APC
  • Extract files and identify the default values for the following parameters PHP Extension,
    Zend Extension using “phpize”
  • tar -xvf APC
    cd APC-X.X.X (replace with your downloaded version)
    phpize
  • If you are running more then one version on the same machine you will need to configure the compilation with the target version of PHP
  • In my case, I used this command to configure the compilation
  • ./configure --with-php-config=/opt/php-5.3/bin/php-config --enable-apc --enable-apc-debug
  • if everything worked ok, then you can compile your extension using make && make install
  • The last step is to enable and configure your extension in the php.ini file (echo “extension=apc.so” > /etc/php.d/apc.ini)
  • Restart PHP service

You can read here a performance benchmark reportĀ hereĀ on the same subject.