← ServerPilot Docs

How to Install the PHP APCu Backwards Compatibility Extension

In the examples shown, replace "7.X" with your app's PHP version (for example, "7.0" or "7.1").

The APCu Backwards Compatibility (apcu-bc) module extends the APCu module to add full backwards compatibility with APC for PHP 7.0, 7.1, and 7.2.

The reason apcu-bc exists is because starting with PHP 7.0, APCu removed the option for full backwards compatibility with APC that existed with APCu in PHP 5.5 and 5.6.

Installing apcu-bc on PHP 7.0, 7.1, 7.2, 7.3, and 7.4

To install apcu-bc, you must first install APCu. If you have not installed APCu, you won't be able to install apcu-bc.

Next, SSH in to your server as root and run the following commands:

sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl7.X-sp install apcu_bc

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/php7.X-sp/conf.d/z_apc.ini"
sudo service php7.X-fpm-sp restart
The configuration file is named z_apc.ini because the apcu-bc extension must be loaded after the APCu extension.

Installing apcu-bc on PHP 5.4, 5.5, and 5.6

The apcu-bc extension is not relevant to PHP versions before PHP 7.0. For PHP 5.4, only the APC extension is relevant. For PHP 5.5 and 5.6, only the APCu extension is relevant.

Verifying the Installation

You can verify apcu-bc is installed correctly by running this command:

php7.X-sp -i | grep -i "APC Compatibility"

You should see output like the following:

APC Compatibility => 1.0.3

Uninstalling the apcu-bc Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/z_apc.ini
sudo peclX.Y-sp uninstall apcu_bc

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes