nextcloudplesk

How to install APCu Object Cache on Ubuntu and integrate in Nextcloud with Plesk

Plesk added integration of php7.3 since Version 17.8.11 Update 35, so I updated my guide for APCu in Plesk and Nextcloud-Integration.

Requirements:

– Plesk Onyx 17.8.11 Update 35
– plesk-php7.3 installed
– root-access

Preparation:

if you have not installed php7.3 yet, you can do so with the following commands as root:

plesk installer update
plesk installer --select-release-current --install-component php7.3

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-php56-dev plesk-php70-dev plesk-php71-dev plesk-php72-dev plesk-php73-dev zlib1g-dev gcc

When the installation is done, we will install the corresponding APCu extension in the context of the individual PHP versions, please make sure that the version number 4.0.11 is used in PHP 5.6:

/opt/plesk/php/5.6/bin/pecl install apcu-4.0.11
/opt/plesk/php/7.0/bin/pecl install apcu
/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

Now we have to tell Plesk the new PHP extension:

echo "extension=apcu.so" > /opt/plesk/php/5.6/etc/php.d/apcu.ini
echo "extension=apcu.so" > /opt/plesk/php/7.0/etc/php.d/apcu.ini
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

and we have to reread PHP-Handler:

plesk bin php_handler --reread

then restart php-fpm one by one:

service plesk-php56-fpm restart
service plesk-php70-fpm restart
service plesk-php71-fpm restart
service plesk-php72-fpm restart
service plesk-php73-fpm restart

If the following error message is displayed when restarting an FPM service:

Job for plesk-php56-fpm.service failed because the control process exited with error code. See "systemctl status plesk-php56-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… 🙂

6 Gedanken zu „How to install APCu Object Cache on Ubuntu and integrate in Nextcloud with Plesk

  1. Hey,

    danke für deine Hilfe, geht aber leider immer noch nicht.

    Meine Plesk.list sieht so aus:
    ## Persistent repositories for Plesk Products.
    deb ftp://ftp.stratoserver.net/pub/plesk/ubuntu/PSA_17.8.11 bionic extras
    deb ftp://ftp.stratoserver.net/pub/plesk/PHP73_17 bionic all

    deb http://autoinstall.plesk.com/ubuntu/PSA_17.8.11 bionic extras
    deb http://autoinstall.plesk.com/PHP71_17 bionic all
    deb http://autoinstall.plesk.com/PHP72_17 bionic all
    deb http://autoinstall.plesk.com/PHP73_17 bionic all

    Meine sources.list:
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic main restricted universe
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-updates main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-updates main restricted universe
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-security main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-security main restricted universe
    deb http://ftp.debian.org/debian stretch main contrib non-free
    deb http://ftp.debian.org/debian stretch-updates main contrib non-free
    deb http://security.debian.org stretch/updates main contrib non-free

    deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse

    deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse

    deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

    deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

    # deb http://archive.canonical.com/ubuntu bionic partner

  2. Hallo,

    ich habe einen Strato vServer mit Plesk und Nextcloud Installation.
    bei “ apt install plesk-php56-dev plesk-php70-dev plesk-php71-dev plesk-php72-dev plesk-php73-dev zlib1g-dev gcc “ bekomme ich als fehlermeldung E: Paket plesk-php….. kann nicht gefunden werden für alle 4 Pakete angezeigt.

    meine sources.list:
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic main restricted universe
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-updates main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-updates main restricted universe
    deb ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-security main restricted universe
    deb-src ftp://ftp.stratoserver.net/pub/linux/ubuntu bionic-security main restricted universe
    deb http://ftp.debian.org/debian stretch main contrib non-free
    deb http://ftp.debian.org/debian stretch-updates main contrib non-free
    deb http://security.debian.org stretch/updates main contrib non-free

    Betriebssystem: Ubuntu 18.04 LTS 64bit + Plesk Onyx

    1. Hallo, ich vermute preinstalled Ubuntu mit Plesk?
      Prüfe mal, ob die plesk.list unter /etc/apt/sources.list.d/plesk.list liegt.

      Wenn nicht anlegen:

      nano /etc/apt/sources.list.d/plesk.list

      Inhalt:

      ## Persistent repositories for Plesk Products.
      deb http://autoinstall.plesk.com/ubuntu/PSA_17.8.11 bionic extras
      deb http://autoinstall.plesk.com/PHP71_17 bionic all
      deb http://autoinstall.plesk.com/PHP72_17 bionic all
      deb http://autoinstall.plesk.com/PHP73_17 bionic all

      dann:

      apt update
      plesk installer update

      Dann versuche es noch mal.

      Wenn das noch nicht reicht, die sources.list anpassen und die Original-Paketquellen eintragen:

      deb http://de.archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
      #deb-src http://de.archive.ubuntu.com/ubuntu bionic main restricted universe multiverse

      deb http://de.archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
      #deb-src http://de.archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse

      deb http://de.archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
      #deb-src http://de.archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

      deb http://de.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
      #deb-src http://de.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

  3. Danke für das Update dieser tollen Anleitung!
    Einen kleinen Zahlendreher habe ich gefunden:
    „apt install plesk-php56-dev plesk-php70-dev plesk-php71-dev plesk-php72-dev plesk-php72-dev zlib1g-dev gcc“

    Das zweite „plesk-php72-dev“ müsste „plesk-php73-dev“ lauten.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.