APCu PHP extension for Plesk PHP 8

This article describes how to install the PHP 8 APCu extension for Plesk Obsidian under Linux. A shell session under the root user is required for the installation.


Preparation

Additional packages must be installed to install the APCu extension:


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


Before installing PHP extensions, a server snapshot should be created so that you can undo the installation with just a few clicks in the event of an error. Learn more →



Installation of the APCu extension


After installing the required dependencies, APCu must be installed individually 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


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


To enable the new configuration via the Plesk web interface, the PHP handlers must be reloaded:

plesk bin php_handler --reread


The affected PHP handlers must then be restarted in order to use the new APCu module:


Warning: Restarting the PHP modules will terminate and restart all running PHP processes. If the installation is carried out 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