Plesk added integration of php7.4 and removed support for php7.0 and php5.6, so I updated my guide for APCu in Plesk and Nextcloud-Integration.
Requirements:
– Plesk Onyx or Obsidian
– plesk-php7.3 installed
– plesk-php7.4 installed
– root-access
Preparation:
if you have not installed php7.3 or php7.4 yet, you can do so with the following commands as root:
plesk installer update plesk installer --select-release-current --install-component php7.3 plesk installer --select-release-current --install-component php7.4
When this is done, we need to install the necessary dev packages for Plesk.
Depending on the usage of the PHP versions it is necessary to install several dev packages. We install the dev packages for PHP versions 5.6, 7.0, 7.1, 7.2 and the new version 7.3:
apt install plesk-php71-dev plesk-php72-dev plesk-php73-dev plesk-php74-dev zlib1g-dev gcc
When the installation is done, we will install the corresponding APCu extension in the context of the individual PHP versions:
/opt/plesk/php/7.1/bin/pecl install apcu /opt/plesk/php/7.2/bin/pecl install apcu /opt/plesk/php/7.3/bin/pecl install apcu /opt/plesk/php/7.4/bin/pecl install apcu
Now we have to tell Plesk the new PHP extension:
echo "extension=apcu.so" > /opt/plesk/php/7.1/etc/php.d/apcu.ini echo "extension=apcu.so" > /opt/plesk/php/7.2/etc/php.d/apcu.ini echo "extension=apcu.so" > /opt/plesk/php/7.3/etc/php.d/apcu.ini echo "extension=apcu.so" > /opt/plesk/php/7.4/etc/php.d/apcu.ini
and we have to reread PHP-Handler:
plesk bin php_handler --reread
then restart php-fpm one by one:
service plesk-php71-fpm restart service plesk-php72-fpm restart service plesk-php73-fpm restart service plesk-php74-fpm restart
If the following error message is displayed when restarting an FPM service:
Job for plesk-php71-fpm.service failed because the control process exited with error code. See "systemctl status plesk-php71-fpm.service" and "journalctl -xe" for details.
and there is no vHost using this version, this can be ignored.
Check:
Within Plesk in "Tools & Settings"
-> "PHP Settings"
, the APCu extension should now be available when selecting a PHP version:
Customization Nextcloud-vHost in Plesk
In the corresponding vHost we adjust the PHP settings and enter the following values under "Additional configuration directives"
:
apc.enabled=1 apc.shm_segments=1 apc.shm_size=256M apc.ttl=3600 apc.user_ttl=7200 apc.gc_ttl=3600 apc.max_file_size=6M apc.stat=0
Now we have to tell Nextcloud to work with the APCu Object Cache. We adapt the file "config.php"
in File Manager:
Here we adjust the value for"memcache.local"
as follows:
'memcache.local' => '\\OC\\Memcache\\APCu',
Check:
We can verify the success with a php script that we have to load in our webspace
We can download the script apc.php
here.
We have to upload this script in our vHost via the File Manager.
Then call the script in our domain via our browser, call https://nextcloud.deine-domain.tld/apc.php:
If we want to look at the "User Cache Entries"
, we have to replace the default password in the script „apc.php“:
In the script "apc.php"
we have to find this line and adjust accordingly:
defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!
If you have questions, dont‘ hesitate to contact me… 🙂