"occ setupchecks" fails with "opcache_get_status() returns false"

Nextcloud version : 28.0.2.5
Operating system and version: Debian GNU/Linux 12 (bookworm) ; Version: 12.4
nginx version : 1.22.1
PHP version 8.2.15

The issue you are facing:

I ran occ setupchecks and encountered this error:

PHP opcache: The PHP OPcache module is not properly configured. OPcache is not working as it should, opcache_get_status() returns false, please check configuration.
The maximum number of OPcache keys is nearly exceeded. To assure that all scripts can be kept in the cache, it is recommended to apply "opcache.max_accelerated_files" to your PHP configuration with a value higher than "10000".
The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply "opcache.memory_consumption" to your PHP configuration with a value higher than "128".
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply "opcache.interned_strings_buffer" to your PHP configuration with a value higher than "16"..

Steps to fix it:
You must make these changes to /etc/php/<php_ver>/cli/php.ini

opcache.enable=1
opcache.enable_cli=1

The solution is to document this requirement in:
https://docs.nextcloud.com/server/stable/admin_manual/installation/php_configuration.html

Yess! That one is new since 28 :+1:


That defaults to 1, so there is no need to explicitly set it → here you find the defaults ←


This one is important to improve cron jobs!


BUT:
Since the occ command runs the cli sapi, it can not say much about the right php configuration for your server.
All the other important settings about your opcache must be set in /etc/php/<php_ver>/fpm/php.ini as well, since that sapi is the one your nginx speaks with :wink:

It is already documented:

here: → ini-values ←

here: → enable-php-opcache ←

and here: → memory-caching ←

Do you think the manual should be improved on this point?


Much and good luck,
ernolf

In my testing, I had to enable both entries in the php.ini file under the cli directory.

I had read about OpCache being enabled by default and I tried not setting opcache.enable=1 in the cli/php.ini file, but it did not work.

Perhaps that default is only for fpm. I can confirm opcache.enable did not need to be enabled to be on by default. The PHP default values page does not specify which php.ini file is being referenced, but they don’t work identically. Perhaps there is an error there also with PHP.

I scoured those documentation pages for any reference to settings for opcache.enable or opcache.enable_cli. There was only one place that “opcache.enable” exists and that only refers to the other two pages.

I did make the same changes in both php.ini files as directed, except for opcache.enable_cli, which had no reference in the fpm version.

So, to answer your question, the manual needs to explain to add both those parameters to the cli/php.ini file to enable OpCache. It could also mention to test this setting with occ setupchecks.

The fact that his impacts the cron jobs makes this more important to get right!

Note that the Administration, Overview does not tag this problem.

Thank you for your prompt attention.

1 Like