APCu PHP Extension for Plesk PHP 8

This article describes how to install the PHP 8 APCu extension for Plesk Obsidian on Linux. Installation requires a shell session as the root user.


Preparation

To install the APCu extension, you must first install the following packages:


apt update
apt install plesk-php80-dev plesk-php81-dev plesk-php82-dev plesk-php83-dev plesk-php84-dev zlib1g-dev gcc make


Before installing PHP extensions, you should create a server snapshot so that you can roll back the installation with just a few clicks in case of an error. Learn more →



Installing the APCu Extension


After installing the required dependencies, APCu must be installed separately for each PHP version:

/opt/plesk/php/8.0/bin/pecl install apcu
/opt/plesk/php/8.1/bin/pecl install apcu
/opt/plesk/php/8.2/bin/pecl install apcu
/opt/plesk/php/8.3/bin/pecl install apcu
/opt/plesk/php/8.4/bin/pecl install apcu
/opt/plesk/php/8.5/bin/pecl install apcu


After installation, the new extension must be added to the PHP configuration:

echo "extension=apcu.so" > /opt/plesk/php/8.0/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/8.1/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/8.2/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/8.3/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/8.4/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/8.5/etc/php.d/apcu.ini


To ensure the new configuration takes effect via the Plesk web interface, the PHP handlers must be reloaded:

plesk bin php_handler --reread


Next, the affected PHP handlers must be restarted to use the new APCu module:


Warning: Restarting the PHP modules will terminate and restart all running PHP processes. If you are performing this installation on a production system, we recommend making this change at night.


# PHP 8.0
systemctl restart plesk-php80-fpm

# PHP 8.1
systemctl restart plesk-php81-fpm

# PHP 8.2
systemctl restart plesk-php82-fpm

# PHP 8.3
systemctl restart plesk-php83-fpm

# PHP 8.4
systemctl restart plesk-php84-fpm

# PHP 8.5
systemctl restart plesk-php85-fpm