APC is an opcode cache that allows PHP to save and reuse the intermediate code generated from PHP source code as a speed optimization.
To install this extension, SSH into your server as root and run the following commands:
sudo apt-get install gcc make autoconf libc-dev pkg-config sudo pecl5.4-sp install apc
Press Enter when asked configuration questions unless you know you want to change any of the defaults.
Once installed, create a configuration file for the extension and restart PHP by running the following commands as root:
sudo bash -c "echo extension=apc.so > /etc/php5.4-sp/conf.d/apc.ini" sudo service php5.4-fpm-sp restart
The following error means you tried to build APC for PHP 5.5 or PHP 5.6. PHP 5.5 and 5.6 include opcode caching by default. APC does not work with PHP 5.5+.
/tmp/pear/temp/APC/apc_compile.c:2417:9: error: 'zend_trait_precedence' has no member named 'function' make: *** [apc_compile.lo] Error 1 ERROR: `make' failed
To uninstall this extension, as root run the commands:
sudo rm /etc/phpX.Y-sp/conf.d/acp.ini sudo pecl5.4-sp uninstall apc
Next, restart PHP-FPM with the command:
sudo service phpX.Y-fpm-sp restart