The PHP OPcache is not properly configured

php72
nc13

#1

I just build this new Nextcloud 13.0.6 using Ubuntu 18.04 with Mariadb, NGINX and php7.2. All is working fine but I cannot pass this check for OPcache.

According to the docs the php.ini file used is under /etc/php/7.2/fpm/php.ini

I edited this file and enabled the lines, and changed the options as required in the “Security and Settings warning”

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

Saved the file, rebooted the server to make sure all is down, but this security warning just does not go away.

Is there another php.ini on another path used for this setup?

Thanks,


Configuration OpCache
#2

also, looking at http://server_name/info.php (I put it there temporarily to see the loaded config)
it does say:

Configuration File (php.ini) Path /etc/php/7.2/fpm
Loaded Configuration File /etc/php/7.2/fpm/php.ini

Could it be something in NGINX?

My other Nextcloud server, same version 13.0.6 running on ubuntu 16.04 has php7.1 with apache2. I checked and /etc/php/7.1/apache2/php.ini has the same settings enabled and I do not see warning on this server as far as opcache.


#3

On CentOS this file is in /etc/php.d/opcache.ini so mayne check there as well?


#4

This setting is absolutely unnecessary and bad for performance. I have no idea how they came up with it.

With this setting php will use the OPcache when running PHP scripts from the command line. However, after the script ends, the OPcache is gone.
In newer versions of PHP one can use a file_cache to solve this problem. The problem is that you don’t want to use a file_cache with php-fpm or the PHP module. Or at least not exclusively.
So, no matter what, if one sets opcache.enable_cli they should also set opcache.file_cache.

For this whole thing to make any sense at all, one would need 2 php.ini files. One for cli and the other for module/sapi. Don’t forget to set opcache.file_cache_only=1 for the cli.
If only one php.ini is used, make sure that both the cli and the web/php-fpm processes can write to the cache directory.


#5

I have the same issue. I haven’t been able to figure it out for several months. Today I came to the forum for answers and found your post. Thanks! :slight_smile:

Here is my config:
Nextcloud server version: 13.0.6
(an upgrade from 13.0.2 did not resolve the issue)

[steve@server ~]$ cat /etc/fedora-release
Fedora release 28 (Twenty Eight)

[steve@server ~]$ php -version
PHP 7.2.9 (cli) (built: Aug 14 2018 14:26:29) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.2.9, Copyright © 1999-2018, by Zend Technologies

[steve@server ~]$ grep opcache /etc/php.ini
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


#6

Starfish, there is no such path in Ubuntu 18.04…


#7

I’m not sure if the recommendation is right or not. . I’m just trying to pass all the checks they require. I don’t think this file is read at all from nextcloud as all the settings are there but the warning remains.


#8

Good to know someone else has the same issue. It appears Nextcloud is not referencing that php.ini file at all because the settings are there. There is another confusion in the file under opcache section. The very first entry that states: “opcache.enable=1” On my other ubuntu 16.04 with apache (same version of nextcloud 13.0.6) with php7.1 this setting shows as “opcache.enable = On” Not sure which one should it be for this new setup. The default that comes in the file is opcache.enable=1. I tried them both but the security warnings remain the same.

Anyone has any information as to how Nextcloud 13.0.6 is interacting with php.ini in Ubuntu 18.04 with Nginx ?


#9

@SteveinPhx Is yours fixed now in Fedora? Did you have it in /etc/php.d/opcache.ini?


#10

No, it is not fixed. Good suggestion on the alternate location under /etc/php.d/, but placing the values in there did not fix it for me either.

[steve@server ]$ grep ^opcache /etc/php.d/10-opcache.ini
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.blacklist_filename=/etc/php.d/opcache*.blacklist
opcache.huge_code_pages=1

I am still getting the same configuration error:
The PHP OPcache is not properly configured. [For better performance it is recommended to use the following settings in the php.ini


#11

Since I have this thing build in a VM and plenty of snapshots saved for different stages, will test following tonight

To make sure this is not specific to 13.0.6 version of Nextcloud, I will:

  1. Take a snapshot of the system
  2. Enable beta channel
  3. Upgrade to 14.0.x

If the security warnings will be gone then I’m not going to bother with fixing it knowing that 14.0.x will be released soon under the stable version. Although this does not prove that the php.ini file in the php-fpm is being used from Nextcloud.

I’ll report back what I find.


#12

Looks like you are using Zendopcache.
I have different setup but zend is in use. Try to find zendopcache.ini and edit it with recommended lines. I don’t know if this works for you or not, but this is how my server is configured.
If that’s not helping, check all .ini files in php.d directory. One of them may have opcache settings. Edit them.


#13

There is a rescan option which you can use and that should actually clear your message. I just updated my OpCache settings in my PHP Ini file, and then clicked the rescan option and the message disappeared. I am using 13.06.


#14

I tried this and did not help. Upgraded to 14.0.0RC2 and the warning was still there. Reverted back to 13.0.6


#15

Where is this “Click” for rescan? I cannot see such option. Which menu is it under?

Thanks,


#16

Not sure if it is related but I’m also missing the folder icons. I see blank for icons. I do see the directory or file name though

ScreenHunter%2095


#17

Its on version 13.06.
So you know where you get that message at the top about your system having some issues? Click on it, resolve them, there is a link called rescan which flushes nextcloud.

I was on an earlier version of nextcloud a few weeks back, I completely rebuilt my next cloud instance to 13.06, and this rescan option appears. It wasn’t in any of the earlier versions I think I was on 13.5. Because I have since cleared my system issues, I can’t take a screenshot to show you.


#18

Try Basic Settings, Security and Setup Warnings


#19

So this is not an upgrade from previous versions, also, it is running on Ubuntu 18.04LTS.

Here is the whole screen under “Basic Settings” I do not see anywhere any “Rescan”. Also like I said I have rebooted the VM several times for other changes (which I think it would have done that rescan by now)

Ignore the first warning about HTTPS, I’m not there yet. Trying to correct the php.ini error first.


#20

Go to your cpanel, go to PHP settings, select the advanced settings option, your PHP.ini file should show up and you can edit in there. Make sure to unremark the line changes, and also enable OPCache while you are at it. I just copied everything out to a text file and made the changes in there and copied it back.