User Tools

Site Tools


php_opcache_error

This is an old revision of the document!


NEXTCLOUD PHP OPCache Error

You possibly searched hours already to fix this annoying error message, despite the terrible instruction by the Nextcloud Community.

To fix this error, first find out what PHP config your Nextcloud is using. Check by typing the following command:

php --ini

This should show some output like this:

Configuration File (php.ini) Path: /etc/php/8.2/cli
Loaded Configuration File:         /etc/php/8.2/cli/php.ini
Scan for additional .ini files in: /etc/php/8.2/cli/conf.d
Additional .ini files parsed:      /etc/php/8.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/8.2/cli/conf.d/10-opcache.ini,
/etc/php/8.2/cli/conf.d/10-pdo.ini,
/etc/php/8.2/cli/conf.d/15-xml.ini,
/etc/php/8.2/cli/conf.d/20-apcu.ini,
/etc/php/8.2/cli/conf.d/20-bcmath.ini,
/etc/php/8.2/cli/conf.d/20-bz2.ini,
/etc/php/8.2/cli/conf.d/20-calendar.ini,
/etc/php/8.2/cli/conf.d/20-ctype.ini,
/etc/php/8.2/cli/conf.d/20-curl.ini,
/etc/php/8.2/cli/conf.d/20-dom.ini,
/etc/php/8.2/cli/conf.d/20-exif.ini,
/etc/php/8.2/cli/conf.d/20-ffi.ini,
/etc/php/8.2/cli/conf.d/20-fileinfo.ini,
/etc/php/8.2/cli/conf.d/20-ftp.ini,
/etc/php/8.2/cli/conf.d/20-gd.ini,
/etc/php/8.2/cli/conf.d/20-gettext.ini,
/etc/php/8.2/cli/conf.d/20-gmp.ini,
/etc/php/8.2/cli/conf.d/20-iconv.ini,
/etc/php/8.2/cli/conf.d/20-igbinary.ini,
/etc/php/8.2/cli/conf.d/20-imagick.ini,
/etc/php/8.2/cli/conf.d/20-intl.ini,
/etc/php/8.2/cli/conf.d/20-ldap.ini,
/etc/php/8.2/cli/conf.d/20-mbstring.ini,
/etc/php/8.2/cli/conf.d/20-mcrypt.ini,
/etc/php/8.2/cli/conf.d/20-memcache.ini,
/etc/php/8.2/cli/conf.d/20-msgpack.ini,
/etc/php/8.2/cli/conf.d/20-mysqli.ini,
/etc/php/8.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/8.2/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/8.2/cli/conf.d/20-phar.ini,
/etc/php/8.2/cli/conf.d/20-posix.ini,
/etc/php/8.2/cli/conf.d/20-readline.ini,
/etc/php/8.2/cli/conf.d/20-redis.ini,
/etc/php/8.2/cli/conf.d/20-shmop.ini,
/etc/php/8.2/cli/conf.d/20-simplexml.ini,
/etc/php/8.2/cli/conf.d/20-soap.ini,
/etc/php/8.2/cli/conf.d/20-sockets.ini,
/etc/php/8.2/cli/conf.d/20-sqlite3.ini,
/etc/php/8.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/8.2/cli/conf.d/20-sysvsem.ini,
/etc/php/8.2/cli/conf.d/20-sysvshm.ini,
/etc/php/8.2/cli/conf.d/20-tokenizer.ini,
/etc/php/8.2/cli/conf.d/20-xmlreader.ini,
/etc/php/8.2/cli/conf.d/20-xmlwriter.ini,
/etc/php/8.2/cli/conf.d/20-xsl.ini,
/etc/php/8.2/cli/conf.d/20-zip.ini,
/etc/php/8.2/cli/conf.d/25-memcached.ini

In this example you see that at the beginning of the output the CLI ini file is used, indicated by (Loaded Configuration File: /etc/php/8.2/cli/php.ini).

Now you know that your Nextcloud is using settings from the /cli/php.ini file.

Edit this file and make sure you have the following in your php.ini file to get rid of the OPCache error

opcache.enable=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=50000
opcache.max_wasted_percentage=15
opcache.revalidate_freq=60
opcache.save_comments=1

Now here comes the funny part! Although you have the correct settings in your PHP.INI file you still might get this error.

Notice when you php –ini that also modules are loaded like /etc/php/8.2/cli/conf.d/10-opcache.ini and other files. That's where the problem lies. The 10-opcache.ini is the file last loaded, overwriting your configuration just set for your OPCACHE!

To solve this issue you need to edit the /etc/php/8.2/cli/conf.d/10-opcache.ini file en comment out anything that is shown. In this example it is zend_extension and opcache.jit:

; configuration for php opcache module
; priority=10
zend_extension=opcache.so
opcache.jit=off

Comment out everthing in this file so you have this:

; configuration for php opcache module
; priority=10
;zend_extension=opcache.so
;opcache.jit=off

Now save the file and reboot your server. The OPCache Error shoud now be gone.

php_opcache_error.1710861959.txt.gz · Last modified: 2024/03/19 16:25 by admin