The PHP OPcache is not properly configured

i don’t think it is a matter of the changes inside the file. I just proved that the php.ini file is totally ignored from Nextcloud, well I should say at least the one in the loaded configuration.

Here is my testing:

Here you can see where is my php.ini

I went on that path, made a copy of the file to php.bak and renamed the php.ini to php.old

ScreenHunter%2097

Rebooted the server,

Ohh well, Nextcould loads with no issues and giving the same warnings which means it is loading some other default config I don’t know from which path…

I also did this other test where I copied the php.ini from /etc/php/7.2/fpm/php.ini to /user/local/bin hoping that it is looking from that path to load the ini file. No luck, still same issue.

Thanks for your help anyway,

And here are the entries inside the php.ini for opcache section:

Looks like this is now fixed by disabliing the Theming app. Once so, I can see the folder icons. Seems like a bug.

Did you try to edit 10-opache.ini in additional .ini files directory?

Fixed! I found another .ini file. Editing this made the error disappear.
/etc/php-zts.d/10-opcache.ini

I left the same settings in /etc/php.ini and /etc/php.d/10-opcache.ini.
Now I’m curious if this fixes the issue for everyone else?

Question:
Before you edited the 10-opcache.ini file and inserted those values, what was there originally?

Here are the differences, before I edited the second file.
I don’t have the original file but here are the values I had to change or uncomment.

[steve@server ~]$ sdiff -s /etc/php.d/10-opcache.ini /etc/php-zts.d/10-opcache.ini
opcache.enable_cli=1 | ;opcache.enable_cli=0
opcache.max_accelerated_files=10000 | opcache.max_accelerated_files=4000
opcache.revalidate_freq=1 | ;opcache.revalidate_freq=2
opcache.save_comments=1 | ;opcache.save_comments=1

Yes, theming app is disabled for me as well. Mainly because I use a specific dark theme rather than the default blue and white, which is a bit hard on my eyes. Very interesting about the opcache.ini file. Anything to make that message go away.

Well, I guess the equivalent path of that .ini file for me on Ubuntu 18.04 is:

/etc/php/7.2/fpm/conf.d/10-opcache.ini

If I open this file I see this:

ScreenHunter%20101

I added these lines and now it looks like so:

ScreenHunter%20102

Rebooted the server and accessed it back. Yes, now I do not see those warning anymore.

This does not make me happy at all. It actually confuses me even more… If Nextclould has a requirement for php then it should use its loaded configuration in the php.ini file. Apparently is not doing it. Does that mean that for opcache instructions it goes to /etc/php/7.2/fpm/conf.d/10-opcache.ini ? What else is missing from this file? We just added those 6-7 lines that the warning was bugging us but what else is missing? I say so because if you compare this file with the php.ini there’s a lot of instructions missing on it. How does this affect Nextcloud?

I guess for now I"ll just leave it like so and hoepfully it helps someone else.

Thanks to all of you for the feedback and suggestions

Ohh, went back to Theming app and enabled it back for testing… My folder icons now stay fine…

Not sure if it was related to this .ini file entries or now… I tested it again by disabling and enabling it and the folder icons do stay. This is good.

For me I receive a warning that opcache is not working.

But when I create a file witht phpinfo() in the installation docroot php shows thet the opcode cache is running.
Is the test in nextcloud broken?
PHP ist 7.2.10 in CentOS 7

@andre.spindler the file is /etc/php.d/opcache.ini

If only ONE of the settings does not correct, it will give you a warning about what it should look like. I roughly translated you message to opcache is not loaded, is that correct?

May be worth double checking the settings, because I think that is rather what NC is moaning about. To verify your settings you could use a small write up I made regarding the install of NC with PHP7.2 on CentOS7.5. It is here.

I had the same problem, and now I’ve finally solved it. I am managing my server with Plesk and in the PHP settings you can find the security option disable_functions which has the delault value opcache_get_status . That’s why Nexcould cannot check the opcache status and therefore claims opcache does not work correctly. If you remove the opcache_get_status entry, the opcache check is passed.

14

I am pretty sure that most of these issues are caused by this PHP security feature.

SOLVED!
I am using ubuntu 18.04 and PHP 7.2, I had to edit /etc/php/7.2/apache2/php.ini where I uncommented and modified the necessary:
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Reloaded Apache and PHP and solved!

Doing the same in /etc/php/7.2/fpm/php.ini did not work at all

1 Like

在php7.0里面这样开启是可以生效的,但是在7.2版本里面是不生效的!我为此烦恼了很久,也重新安装php了几次;

解决办法文档: https://blog.csdn.net/qq_30333779/article/details/80344407

php7.2版本开启opcache:

[opcache]
zend_extension= opcache 加上这个参数就重启php-fpm就可以了
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1
opcache.fast_shutdown=1

If you are using PHP FPM, you also need to change values there. With this you should be able to correct configure PHP Opcache. Also, you can use opcache gui tools to monitor performance and issues in this regard.