Page 1 of 3

Nextcloud OPcache

Posted: Mon Sep 21, 2020 10:19 am
by novitibo
Hi.
What php.ini should be edited, since there are several php.ini files in system?

Nextcloud since upgrade v18>v19 shows following info:
...
There are some warnings regarding your setup.
The PHP OPcache is not properly configured. For better performance it is recommended to use the following settings in the php.ini:
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
...
Additionally shows also this:
...
This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
bcmath
gmp
...
What is the command to install those missing PHP modules?

Tnx!

Br,B

Re: Nextcloud OPcache

Posted: Mon Sep 21, 2020 11:40 am
by Joulinar
Hi,

many thanks for your report. Let me assume you have installed PHP7.3. There you could have a look if the following file exist.

Code: Select all

/etc/php/7.3/mods-available/dietpi-nextcloud.ini
it should contain the setting for opcache

Code: Select all

root@DietPi3:~# cat /etc/php/7.3/mods-available/dietpi-nextcloud.ini
; Nextcloud PHP settings
; priority=98
apc.enable_cli=1
opcache.enable=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
root@DietPi3:~#
Installation of recommended packages could be done as follow

Code: Select all

apt update 
apt install php7.3-bcmath php7.3-gmp php7.3-imagick
once done restart all services

Code: Select all

dietpi-services restart

Re: Nextcloud OPcache

Posted: Mon Sep 21, 2020 9:28 pm
by MichaIng
bcmath and gmp are btw only required for password-less key authentication. I'd actually like so see this information instead of stating a bid misleading that performance and compatibility are limited when those "highly recommended" packages are not installed, while nearly no-one enables key authentication, especially since password authentication is always available as fallback, hence there is no security gain: https://github.com/nextcloud/server/issues/22849

imagick is only used by the theming app and there are security concerns about using it, although I lack the understanding: https://github.com/nextcloud/server/issues/13099

Just as an explanation why we don't pre-install those automatically ;).

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 9:50 am
by novitibo
root@DietPi:/# locate dietpi-nextcloud.ini
/etc/php/7.3/cgi/conf.d/99-dietpi-nextcloud.ini
/etc/php/7.3/cli/conf.d/99-dietpi-nextcloud.ini
/etc/php/7.3/fpm/conf.d/99-dietpi-nextcloud.ini
/etc/php/7.3/mods-available/dietpi-nextcloud.ini

those files already contained the setting for opcache.

Warning remains... :(

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 1:15 pm
by MichaIng
Any other config in place which sets OPcache settings with higher priority?

Code: Select all

grep -r opcache /etc/php/7.3/

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 1:26 pm
by novitibo
grep found several ini's:
/etc/php/7.3/cgi/php.ini
/etc/php/7.3/mods-available/opcache.ini
/etc/php/7.3/mods-available/dietpi-nextcloud.ini
/etc/php/7.3/mods-available/dietpi.ini
/etc/php/7.3/cli/php.ini
/etc/php/7.3/fpm/php.ini

and also grep -r opcache /etc/php/7.4/ found the same ones in /etc/php/7.4/ folder. Wich one nextcloud service uses?

I don't know the priorities, but in all opcache setting can be adjusted...

Should we try to adjust all of them or there is a better way to understand this setting?

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 2:46 pm
by MichaIng
It should use PHP7.3 on Stretch and Buster and PHP7.4 only on Bullseye. Which Debian version is it and RPi 1 or RPi Zero or a different machine?

Code: Select all

echo $G_HW_MODEL_NAME $G_DISTRO_NAME
And which web server, Nginx or Lighttpd?

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 2:59 pm
by novitibo
it's
RPi 3 Model B (armv7l) stretch with Lighttpd

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 3:06 pm
by MichaIng
Ah okay Stretch. The 7.4 dir structure comes from APCu module then, but the php.ini files should not exist.

Lets see what the webserver uses: grep -r sock /etc/lighttpd/
And then what is installed: dpkg -l | grep php

Re: Nextcloud OPcache

Posted: Tue Sep 22, 2020 3:16 pm
by novitibo
grep -r sock /etc/lighttpd/
/etc/lighttpd/conf-available/15-fastcgi-php.conf: "socket" => "/run/php/php7.3-fpm.sock",
/etc/lighttpd/conf-available/50-dietpi-https.conf:$SERVER["socket"] == ":443" {
/etc/lighttpd/conf-available/10-ssl.conf:$SERVER["socket"] == "0.0.0.0:443" {

dpkg -l | grep php
ii php-apcu 5.1.18+4.0.11-1+0~20200518.14+debian9~1.gbpa99079 armhf APC User Cache for PHP
ii php-bcmath 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all Bcmath module for PHP [default]
ii php-cgi 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all server-side, HTML-embedded scripting language (CGI binary) (default)
ii php-common 2:76+0~20200511.26+debian9~1.gbpc9beb6 all Common files for PHP packages
ii php-curl 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all CURL module for PHP [default]
ii php-fpm 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all server-side, HTML-embedded scripting language (FPM-CGI binary) (default)
ii php-gd 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all GD module for PHP [default]
ii php-gmp 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all GMP module for PHP [default]
ii php-igbinary 3.1.2+2.0.8-1+0~20200518.16+debian9~1.gbp1a098b armhf igbinary PHP serializer
ii php-intl 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all Internationalisation module for PHP [default]
ii php-mbstring 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all MBSTRING module for PHP [default]
ii php-mysql 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all MySQL module for PHP [default]
ii php-redis 5.3.1+4.3.0-1+0~20200708.25+debian9~1.gbp800f71 armhf PHP extension for interfacing with Redis
ii php-sqlite3 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all SQLite3 module for PHP [default]
ii php-xml 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii php-zip 2:7.4+76+0~20200511.26+debian9~1.gbpc9beb6 all Zip module for PHP [default]
ii php7.3-bcmath 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf Bcmath module for PHP
ii php7.3-cgi 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf server-side, HTML-embedded scripting language (CGI binary)
ii php7.3-cli 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf command-line interpreter for the PHP scripting language
ii php7.3-common 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf documentation, examples and common module for PHP
ii php7.3-curl 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf CURL module for PHP
ii php7.3-fpm 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.3-gd 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf GD module for PHP
ii php7.3-gmp 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf GMP module for PHP
ii php7.3-intl 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf Internationalisation module for PHP
ii php7.3-json 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf JSON module for PHP
ii php7.3-mbstring 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf MBSTRING module for PHP
ii php7.3-mysql 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf MySQL module for PHP
ii php7.3-opcache 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf Zend OpCache module for PHP
ii php7.3-readline 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf readline module for PHP
ii php7.3-sqlite3 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf SQLite3 module for PHP
ii php7.3-xml 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii php7.3-zip 7.3.22-1+0~20200909.67+debian9~1.gbpdd7b72 armhf Zip module for PHP
ii php7.4-bcmath 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf Bcmath module for PHP
ii php7.4-cgi 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf server-side, HTML-embedded scripting language (CGI binary)
ii php7.4-cli 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf command-line interpreter for the PHP scripting language
ii php7.4-common 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf documentation, examples and common module for PHP
ii php7.4-curl 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf CURL module for PHP
ii php7.4-fpm 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php7.4-gd 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf GD module for PHP
ii php7.4-gmp 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf GMP module for PHP
ii php7.4-intl 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf Internationalisation module for PHP
ii php7.4-json 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf JSON module for PHP
ii php7.4-mbstring 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf MBSTRING module for PHP
ii php7.4-mysql 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf MySQL module for PHP
ii php7.4-opcache 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf Zend OpCache module for PHP
ii php7.4-readline 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf readline module for PHP
ii php7.4-sqlite3 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf SQLite3 module for PHP
ii php7.4-xml 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf DOM, SimpleXML, XML, and XSL module for PHP
ii php7.4-zip 7.4.10-1+0~20200909.25+debian9~1.gbpe666e1 armhf Zip module for PHP