The APCu extension adds object caching functions to PHP.
APCu is the official replacement for the outdated APC extension. APC provided both opcode caching (opcache) and object caching. Once PHP began including its own opcache, APC was no longer compatible and its opcache functionality became useless. The developers of APC then created APCu, which offers only the object caching functionality (they removed the outdated opcache).
To install this extension on PHP 7 or PHP 8, SSH in to your server as root and run these commands:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config sudo peclX.Y-sp install apcu
When asked the following question, press Enter.
Enable internal debugging in APCu [no] :
Once installed, create a configuration file for the extension and restart PHP by running the following commands as root
sudo bash -c "echo extension=apcu.so > /etc/phpX.Y-sp/conf.d/apcu.ini" sudo service phpX.Y-fpm-sp restart
To install this extension on PHP 5.6, SSH in to your server as root and run these commands:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config sudo pecl5.6-sp install apcu-4.0.11
When asked the following questions, press Enter.
Enable full APC compatibility [yes] : Enable internal debugging in APCu [no] :
Once installed, create a configuration file for the extension and restart PHP by running the following command as root:
sudo bash -c "echo extension=apcu.so > /etc/php5.6-sp/conf.d/apcu.ini" sudo service php5.X-fpm-sp restart
You can verify APCu is installed correctly by running the command:
phpX.Y-sp -i | grep apcu
You should see output like the following:
Additional .ini files parsed => /etc/phpX.Y-sp/conf.d/apcu.ini, apcu
To uninstall this extension, as root run the commands:
sudo rm /etc/phpX.Y-sp/conf.d/apcu.ini sudo peclX.Y-sp uninstall apcu
Next, restart PHP-FPM with the command:
sudo service phpX.Y-fpm-sp restart