Nextcloud 12 Beta 2 PHP Opcache is not properly configured

Once i upgraded from 11.0.3 to 12 getting the below warring, can anyone help?

Security & setup warnings

It’s important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the Tips & Ticks section and the documentation for more information.

The PHP Opcache is not properly configured. For better performance we recommend :arrow_upper_right: to use following settings in the php.ini:
opcache.enable=On
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
Please double check the installation guides :arrow_upper_right:, and check for any errors or warnings in the log.

1 Like

hi,
this is already discussed in other threads.
please just set

opcache.enable=On

to

opcache.enable=1

that’s all :slight_smile: but don’t forget to restart php …

Thank you! But how do i change the config tho, just type that command in terminal?

logon using e.g. ssh

cp /etc/php/7.1/fpm/php.ini /etc/php/7.1/fpm/php.ini.bak
vi /etc/php/7.1/fpm/php.ini

cp /etc/php/7.1/cli/php.ini /etc/php/7.1/cli/php.ini.bak
vi /etc/php/7.1/cli/php.ini

substitute opcache.enable=On to opcache.enable=1

1 Like

I’m still running PHP 7.0 dose that effect anything?

In that case it is …/7.0/…

If you use mod_php instead of php_fpm its:

cp /etc/php/7.0/apache2/php.ini /etc/php/7.0/apache2/php.ini.bak
vi /etc/php/7.0/apache2/php.ini

it is valid and recommended for PHP 7.x (7.0, 7.1, 7.x)
depending on your environment (nginx / apache2, …) the directories may differ, but the setting remain the same :wink:

Still same error, below is my PHP config thats in /etc/php/7.0/apache2/php.ini &
/etc/php/7.0/cli/php.ini

[PHP]

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1

; The OPcache shared memory storage size.
opcache.memory_consumption=128

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=8

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
;opcache.max_accelerated_files=10000

; The maximum percentage of “wasted” memory until a restart is scheduled.
;opcache.max_wasted_percentage=5

; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
; files with the same name (basename). Disabling the directive improves
; performance, but may break existing applications.
;opcache.use_cwd=1

; When disabled, you must reset the OPcache manually or restart the
; webserver for changes to the filesystem to take effect.
;opcache.validate_timestamps=1

; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. (“1” means validate once per second, but only
; once per request. “0” means always validate)
opcache.revalidate_freq=1

; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0

; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
opcache.save_comments=1

; If enabled, a fast shutdown sequence is used for the accelerated code
;opcache.fast_shutdown=0

; Allow file existence override (file_exists, etc.) performance feature.
;opcache.enable_file_override=0

; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
;opcache.optimization_level=0xffffffff

;opcache.inherited_hack=1
;opcache.dups_fix=0

; The location of the OPcache blacklist file (wildcards allowed).
; Each OPcache blacklist file is a text file that holds the names of files
; that should not be accelerated. The file format is to add each filename
; to a new line. The filename may be a full path or just a file prefix
; (i.e., /var/www/x blacklists all the files and directories in /var/www
; that start with ‘x’). Line starting with a ; are ignored (comments).
;opcache.blacklist_filename=

; Allows exclusion of large files from being cached. By default all files
; are cached.
;opcache.max_file_size=0

; Check the cache checksum each N requests.
; The default value of “0” means that the checks are disabled.
;opcache.consistency_checks=0

; How long to wait (in seconds) for a scheduled restart to begin if the cache
; is not being accessed.
;opcache.force_restart_timeout=180

; OPcache error_log file name. Empty string assumes “stderr”.
;opcache.error_log=

; All OPcache errors go to the Web server log.
; By default, only fatal errors (level 0) or errors (level 1) are logged.
; You can also enable warnings (level 2), info messages (level 3) or
; debug messages (level 4).
;opcache.log_verbosity_level=1

; Preferred Shared Memory back-end. Leave empty and let the system decide.
;opcache.preferred_memory_model=

; Protect the shared memory from unexpected writing during script execution.
; Useful for internal debugging only.
;opcache.protect_memory=0

; Allows calling OPcache API functions only from PHP scripts which path is
; started from specified string. The default “” means no restriction
;opcache.restrict_api=

; Mapping base of shared memory segments (for Windows only). All the PHP
; processes have to map shared memory into the same address space. This
; directive allows to manually fix the “Unable to reattach to base address”
; errors.
;opcache.mmap_base=

; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default “” disables file based caching.
;opcache.file_cache=

; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0

; Enables or disables checksum validation when script loaded from file cache.
;opcache.file_cache_consistency_checks=1

; Implies opcache.file_cache_only=1 for a certain process that failed to
; reattach to the shared memory (for Windows only). Explicitly enabled file
; cache is required.
;opcache.file_cache_fallback=1

; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
;opcache.huge_code_pages=1

; Validate cached file permissions.
; opcache.validate_permission=0

; Prevent name collisions in chroot’ed environment.
; opcache.validate_root=0

Here’s some more info too
php -i | grep opcache
/etc/php/7.0/cli/conf.d/10-opcache.ini,
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 => 2000 => 2000
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

This is still commented out ;). Therefore standard value is used:

1 Like

Thank you very much!! :slight_smile:

opcache.enable=On

persists in NC12 Beta3!

I updated to beta 3 and my setting=1 no issues.

Yes, but if you update from 11.03, your opcache is not set and you get the warning with the wrong hint you should set it to On instead of 1…

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

First, find the location of opcache.so:
$ sudo find / -name ‘opcache.so
/usr/lib/php/20151012/opcache.so # 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

zend_extension=/usr/lib/php/20151012/opcache.so
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

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

3 Likes

Thanks @Asif_Khan this fixed my checks failing after moving to NC 12.0.0

FYI - In my freebsd with php 7,

Simply added:

zend_extension=opcache.so ### <-- Was already there. ###
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.save_comments=1
opcache.revalidate_freq=0
opcache.fast_shutdown=1
opcache.validate_timestamps=0

to the opcache.ini file in: /usr/local/etc/php

Restarted php-fpm and nginx and error message gone!

Thanks

1 Like

I had the same problem with the final version of Nextcloud 12, and resolve installing the opcache for php7 in Opensuse Leap.

For CentOS7 and remi repo (https://rpms.remirepo.net/):

yum install php-opcache
vi /etc/php.d/opcache.ini
and add:
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
and do:
systemctl restart httpd

Works like a charm :slight_smile:

Hi Folks,

I’m struggling with this same error.
I have uncommented and edited these values in /etc/php/7.0/fpm.php.ini thus:
myprompt:/etc/php/7.0/fpm# more php.ini | grep opcache
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=1000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=1
;opcache.revalidate_path=0
opcache.save_comments=1
;opcache.fast_shutdown=0
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
; opcache.validate_permission=0
; opcache.validate_root=0

and in /etc/php/7.0/cli thus:
myprompt:/etc/php/7.0/cli# more php.ini | grep opcache
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=1000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=1
;opcache.revalidate_path=0
opcache.save_comments=1
;opcache.fast_shutdown=0
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
; opcache.validate_permission=0
; opcache.validate_root=0

I aslo tried Asif_Khan’s method but that didn’t work for me.

I’ve got a fresh install of NC v12.0.1.5 on Raspbrian Jessie

Thanks for any help

david

Any other clues?