Installing PHP APCu Backwards Compatibility Plugin

Last updated on by Digamber
The APCu Backwards Compatibility (apcu-bc) plugin include the backward compatibility with APC PHP 7+

apcu-bc plugin came into existence since PHP 7.0, since APCu stopped providing the full backward compatibility support along with APCu in PHP 5.5 and 5.6.

How to Install APCu Backwards Compatibility Plugin on PHP 7.0, 7.1, 7.2?

You must have APCu installed in your machine to use apcu-bc. Remember you can’t install apcu-bc unless you have installed APCu.

Then log in to your server as a root user using SSH credentials.

sudo apt-get -y install gcc make autoconf libc-dev pkg-config

sudo pecl7.X-sp install apcu_bc

After successful installation, don’t forget to generate a configuration file for a PHP extension. Hit the below command in terminal to restart the PHP.

# Replace php7.X-sp => X with your PHP version

sudo bash -c "echo > /etc/php7.X-sp/conf.d/z_apc.ini"
sudo service php7.X-fpm-sp restart

How to Verify the Installation?

Enter the below command in the terminal, to check whether apcu-bc is working perfectly

# Replace php7.X-sp => X with your PHP version
php7.X-sp -i | grep -i "APC Compatibility"
# Following will be the output:
APC Compatibility => 1.0.3

How to Uninstall the apcu-bc Extension in PHP?

You have to login your server as a root user to uninstall apcu-bc extension.

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

Finally, use the given below command to restart the PHP-FPM.

sudo service phpX.Y-fpm-sp restart