Opcache.memory_consumption insane values needed by nextcloud

Hello Community,

I got the message, that “opcache.memory_consumption” should be bigger than 1024. Okay, I’ve edit the value to 2048.

Reload → nextcloud told me, should be bigger that 2048 … and so on.

What is the perfect value and which should I set?

Here is my current values:

opcache.enable_cli=1
apc.enable_cli=1
opcache.save_comments=1
opcache.revalidate_freq=60
opcache.validate_timestamps=0
opcache.interned_strings_buffer=512
opcache.max_accelerated_files=10000
opcache.memory_consumption=2048

Cheers

Hello @Toorms

what I’m missing in your config is opcache.enable=1 did you forget to include it here or is it missing?
The message you’re refering to is shown when more than 90% of the max value is reached, so there’s no hardcoded value here (see server/CheckSetupController.php at 2dea9a1bd501c4d882dce0463350ac4f87b5bc99 · nextcloud/server · GitHub)

According to the docs (https://docs.nextcloud.com/server/20/admin_manual/installation/server_tuning.html#enable-php-opcache) a value of 128 is recommended. I’m running with 256 just fine without the message…

Hello @SysKeeper

Thanks for your post. Yes, I forgot the opcache.enable=1, my bad. Now the configuration is these:

opcache.enable=1
opcache.enable_cli=1
apc.enable_cli=1
opcache.save_comments=1
opcache.revalidate_freq=1
opcache.validate_timestamps=0
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=10000
opcache.memory_consumption=256

But after a php-fpm restart I still got the message, that opcache.memory_consumption = 256 and opcache.interned_strings_buffer = 32 is not enough.

I got these error

Zend OPcache can’t be temporary enabled (it may be only disabled till the end of request) at Unknown#0

instead of my final configurations

opcache.enable=1
opcache.enable_cli=1
opcache.save_comments=1
opcache.revalidate_freq=1
opcache.validate_timestamps=0
opcache.interned_strings_buffer=128
opcache.max_accelerated_files=10000
opcache.memory_consumption=512
<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'cloud.mycloud.com',
  ),
  'datadirectory' => '/home/users/files/cloud.mycloud.com',
  'dbtype' => 'mysql',
  'version' => '24.0.1.1',
  'overwrite.cli.url' => 'https://cloud.mycloud.com',
  'dbname' => '',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' => [
     'host' => '127.0.0.1',
     'port' => 6379,
   ],
  'log_type' => 'file',
  'logfile' => '/home/users/files/cloud.mycloud.com/nextcloud.log',
  'loglevel' => '3',
  'logdateformat' => 'F d, Y H:i:s',
  'lost_password_link' => 'disabled',
  'default_phone_region' => '',
  'defaultapp' => 'files',
  'maintenance' => false,
  'mail_from_address' => 'sender',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '587',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
);

I don’t know why it doesn’t work right now. :confused: Sensitive data are blanked out.

Searching for this error indicates that this usually happens when you try to enable opcache twice, so maybe there’s another “opcache.enable=1” somewhere ? Maybe in your php.ini and in your fpm config?

As you can see below no. Only enabled in some specified w3-total-cache folders.

root@marge:~# grep --include=\*.ini -rnw '/' -e "opcache.enable"
/home/users/user1/www/wp-content/plugins/w3-total-cache/ini/opcache.ini:5:opcache.enable = 1
/home/users/user2/www/wp-content/plugins/w3-total-cache/ini/opcache.ini:5:opcache.enable = 1
/home/users/user3/www/wp-content/plugins/w3-total-cache/ini/opcache.ini:5:opcache.enable = 1
/home/users/user4/www/wp-content/plugins/w3-total-cache/ini/opcache.ini:5:opcache.enable = 1
/opt/servermanager/php/8.1/etc/php.ini:1767:;opcache.enable=1
/etc/php/7.4/cli/php.ini:1771:;opcache.enable=1
/etc/php/7.4/apache2/php.ini:1769:;opcache.enable=1
/etc/php/7.4/fpm/php.ini:1769:;opcache.enable=1

Hi, some additional reading regarding the Opcache warnings:

https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html?highlight=opcache#enable-php-opcache

The idea of the warning is to make you aware that the opcache configuration is not sufficient. That can happen when beside Nextcloud other php applications are installed and all applications are using the same php fpm process as the opcache limits are per process afaik.

GitHub - amnuts/opcache-gui: A clean, effective and responsive interface for Zend OPcache can help you to get a better overview about the opcache status.

cc @MichaIng

The Opcache is per PHP version shared with other applications (websites a.s.o.). So this cache is not unique fro Nextcloud.
There is a simple tool that you can download on github to show this behavior.
I’ve already made other messages that describe what is going wrong. I explained my findings there.

So it does not matter to what values you set the parameters. Even with 32000 memory, this warming will stay if your server is hosting more then just Nextcloud with the same PHP version.

If you do not want to see these warnings, you have to comment out a few lines in the code. See my other reply. After that the green V is back again.

I would expect to see another warning then from the integrity check because you modified a core file.

If you have a own php.ini (or something similar) you may add opcache_get_status to disable_functions. The check is skipped without a warning then :wink:

See https://help.nextcloud.com/t/the-php-opcache-module-is-not-properly-configured/13587 for the false positive opcache.interned_strings_buffer warning. Still no permanent solution available for this.

hi, can’t access your link…

Me 2. Give Search results for 'the php opcache module is not properly configured' - Nextcloud community a try… good luck as there are plenty of topics -.-

1 Like