Which file for editing opcache settings

Hi All,

I got the message:

it is recommended to apply "opcache.interned_strings_buffer" to your PHP configuration with a value higher than "8"

So I had a look at the docs but could not find where to edit this:
I guess it is the php.ini in the folder: /etc/php/8.1/apache2

But according to the docs it could also be the config.php in /var/www/html/nextcloud/public/config

I tried first to change it in the php.ini and changed these values:

opcache.enable=1
opcache.interned_strings_buffer=16
opcache.save_comments = 1
opcache.revalidate_freq = 60

However still get the message. Any ideas?

Thanks S

Do you use FPM?

If you don’t know: create a php file with this content:

<?php phpinfo(); ?>

If you open that file on your server you should see in the first table a php.ini config file path. In this file you can adjust your settings.

After that it is important to restart PHP and/or Apache. Then check NextCloud again and delete the phpinfo-file.

In the config.php you can’t set this values.

That depends on the SAPI which is used by your webserver to comunicate with php.

That CAN be libapache2-mod-php but it can just as easily be php-fpm.


You did not provide any information about your operating system. This is for Ubuntu/Debian like OSes:

The most important sapis are:

Command Line Interface

  • cli
  • package: php<VER>-cli
  • description:
    cli is used by php scripts invoked from the command line. i.e. all processes
    that were explicitly NOT called by the web server (cron jobs, occ commands,
    etc.)

Apache2 module

  • apache2
  • package: libapache2-mod-php<VER>
  • description:
    the apache2 module is the default sapi for apache2. The downside is that it’s
    not particularly scalable and doesn’t support http2.
    libapache2-mod-php relies on the old but stable Multi-Processing Module (MPM)
    mpm-prefork”.

Fast Process Manager

  • fpm
  • package: php<VER>-fpm
  • description:
    this is the default sapi used by nginx. On apache2 php-fpm relies on the more
    scalable threaded MPM “mpm-event”. Additionally it needs the apache2-modules
    proxy_fcgi” and “setenvif”.

Every sapi has its own php.ini file:

  /etc/php/<VER>/<SAPI>/php.ini

If your webserver is apache2, you can find out the active mpm (Multi Processing
Module) with this command call:

user@box:~# sudo apachectl -M 2>/dev/null | grep mpm

as explained above, the “mpm_event_module” means that apache2 speaks via fpm,
while the “mpm_prefork_module” indicates that the apache2 module is used for the
comunication between webserver and php.

The sapi used by apache 2 can also be found out with this command call:

user@box:~# sudo apachectl -tD DUMP_INCLUDES 2>/dev/null | grep -v sites | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'
copy&pasted from php-updater script

If this does not help you, you may have to provide more information about your system.


Much and good luck,
ernolf

Since nextcloud 28, this is no longer necessary because it is provided by the Nextcloud server itself. It only needs to be activated with occ:

./occ config:app:set --value=yes serverinfo phpinfo

as described → here ←


ernolf

1 Like

Oh cool, thanks! I didn‘t know that :+1:

Thanks a lot. It worked. I activated the info with:

occ config:app:set --value=yes serverinfo phpinf

For here I could find the php.ini path (which is /etc/php/8.1/fpm/php.ini in my case)

And there I increased the value for 8 to 16

Thanks S

1 Like