PHP Opcache not correctly

First, I’m running this Setup of Nextcloud on a Raspberry Pi 2 with Php 5.
I’ve made the Update to Nextcloud 12 today and now in my Administration Panel there is a Note wich says that
PHP Opcache is not working correctly and I should modify my php.ini File. But now I’m not sure wich File i had to edit.
I made all entries in the /etc/php5/apache2/php.ini File and the /etc/php5/cli/php.ini also. Then I made a Reboot of my Server but the Note is still there.
Would be nice when someone can help me out here :slight_smile:

I think the first file you mentioned is the one you need to modify, for Apache2. I also think you need to verify that cron has run for Nextcloud for it to rescan these changes, so even rebooting your server may not have been enough. Otherwise double check that you did indeed write the changes to that file, then restart Apache, then wait for the Nextcloud cron job to run and check again.

Okay thanks for your answer :slight_smile:
I double checked that i write the changes in the Files I listet above and after this i made a restart of Apache.
My Server uses the AJAX Cron that makes a new run every Time you visit the Site, should i change this?
Otherwise, the Note is still there…

Well, did you make all changes exactly as they recommended in php.ini? I’m not sure if that matters, but I had no trouble making the changes to resolve that message on mine.
AJAX cron is just slow (aka poor man’s cron), although they may claim no performance hit it really can slow things down. It also relies on people visiting the site, so it could potentially not run for a long time if nobody is on your site. It is strongly recommended to use the system’s cron assuming you have access to the server because it automatically runs every 15 minutes, taking care of all maintenance including notifications.

I changed the Server now to System Cron and checked the Settings again…
Still not working correctly :confused:

Sorry, I don’t know what else to try then. Do you mind sharing your php.ini? Sometimes another set of eyes can help.

Sure i would share it but i can’t upload it because the File is not supported here…and there are also to much Signs in it…

Sorry for double Post…but I checked the Apache Log file and there are some of these entries in it.

PHP Warning:  Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) in Unknown on line 0

Found the solution via Google, an other User had the same Problem with an PHP5 and Opcache :slight_smile:
I share it here, when someone had the same Problem.

Do not edit the /etc/php5/cli/php.ini File with the Values the Administration Notes gives you.

Only edit the /etc/php5/apache2/php.ini if your on PHP5

Then, edit the following /etc/php5/mods-available/opcache.ini

I put in the Values in the Administration Note and restarted the apache Server.

sudo /etc/init.d/apache2 restart

That makes it working for me.

1 Like

Hello everyone Finally I found a solution and for me All checks passed.

First, find the location of
$ sudo find / -name ‘
/usr/lib/php/20151012/ # On my server with php 7.0

Once you have the location, you can add that to the conf file for opcache:
$ sudo nano /etc/php/7.0/mods-available/opcache.ini # On my server with php 7.0

Add the following to opcache.ini


Save the file and then you can exit.
$ sudo systemctl restart apache2.service


Here is the config for CentOS 7… (is anyone is searching for it :wink: )

~# yum install php70w-opcache

~# nano /etc/php.d/opcache.ini

Find this values with STRG+W and change them!


Thank you that you share this solution. Now i have change the Backround Service to Cron (before AJAX) and restart the Server (in my case a restart from the apache2 Server doesn’t help)

1 Like

Thanks clouduser - this also fixed my issue, running CentOS 7 with php 7.1

Thanks, that worked for me!

1 Like

Hello all,
since short I have the same problem, funny thing is that Upgrade to NC 13 was done long time ago and nobody touch the system and it starts…
I try everything from the post, but it does not work for me, still have the same error. Is there is any solution?

# php -i | grep opcache
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 0 => 0
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 1 => 1
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On

System Ubuntu 16.04.
NC 13
PHP fpm 7.0.25
Apache/2.4.29 (Ubuntu)
HTTP2 enabled as here.

Thank you, finally resolved the opcache issue for me on raspbian (Jessie/OMV 3) with NC 13.

OMV 3 use PHP5, then my was in /usr/lib/php5/20131226. Then I had zend_extension=/usr/lib/php5/20131226/ in to opcache.ini

You save my day!

1 Like

Many thanks, this worked perfect.
Centos 7 with php70

for all Plesk onyx / ubuntu Users, having this problem:

i had problems after upgrading from 13.x to 14.x, no plesk config changed, but the solved opcache error again.

the problem is one php ini opcache parameter in php setting in the domain config:
disable_functions is set to opcache_get_status

deleting this function and set disabled_function empty, nexcloud message is gone.

Dude, thank you
I’ve been scratching my head because no matter how I edit any php.ini file, opcache stayed disabled until I tried your solution and it works perfectly. I’m on Debian 10 Buster, in case anyone else wants to know =)

1 Like

Hello everyone! I have make this changes in 10-opcache.ini and in php.ini. still the error remains same. I am using php 7.3.20 and nextclloud 20.0.2. Do i need to install php70w-opcache ? and put the values in opcache.ini?

Thank you