Can't get rid off "The PHP OPcache module is not properly configured" Warning

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 24.0.1.1
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 11. 5.15.32-v8+ (aarch64)
Apache or nginx version (eg, Apache 2.4.25): Server version: Apache/2.4.53 (Debian) Server built: 2022-03-14T16:28:35
PHP version (eg, 7.4): PHP 7.4.28 (cli) (built: Feb 17 2022 16:17:19) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies

The issue you are facing:

I can’t get rid of the OPcache warning, even after adjusting the settings as seen in the documentation, also searched the forum, but can’t find a solution somehow, maybe I am overlooking something here? Would appreciate the help (:

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Upgrade Nextcloud I think
  2. There are some warnings regarding your setup.
  • The PHP OPcache module is not properly configured. See the documentation :arrow_upper_right: for more information.
    • The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.

The output of your php.ini file in /etc/php/7.4/apache2/php.ini (make sure you remove any identifiable information!):

[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=0

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

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

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 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=0

; 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=60

; 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
; 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=0x7FFFBFFF

;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=

; Facilitates multiple OPcache instances per user (for Windows only). All PHP
; processes with the same cache ID and user share an OPcache instance.
;opcache.cache_id=

; 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

; If specified, it produces opcode dumps for debugging different stages of
; optimizations.
;opcache.opt_debug_level=0
; Specifies a PHP script that is going to be compiled and executed at server
; start-up.
; http://php.net/opcache.preload
;opcache.preload=

; Preloading code as root is not allowed for security reasons. This directive
; facilitates to let the preloading to be run as another user.
; http://php.net/opcache.preload_user
;opcache.preload_user=

; Prevents caching files that are less than this number of seconds old. It
; protects from caching of incompletely updated files. In case all file updates
; on your site are atomic, you may increase performance by setting it to "0".
;opcache.file_update_protection=2

; Absolute path used to store shared lockfiles (for *nix only).
;opcache.lockfile_path=/tmp

ncp-report output:

NextCloudPi diagnostics

NextCloudPi version  v1.47.2
NextCloudPi image    NextCloudPi_11-27-20
OS                   Debian GNU/Linux 11. 5.15.32-v8+ (aarch64)
automount            yes
USB devices          sda sdb
datadir              /media/data/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      345G/477G
rootfs usage         8.4G/118G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    24.0.1.1
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            wlan0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               11days

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "1": "***REMOVED SENSITIVE VALUE***",
            "2": "***REMOVED SENSITIVE VALUE***",
            "14": "nextcloudpi",
            "3": "nextcloudpi",
            "11": "***REMOVED SENSITIVE VALUE***"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "default_phone_region": "DE",
        "version": "24.0.1.1",
        "overwrite.cli.url": "https:\/\/nextcloudpi\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/media\/data\/ncdata\/tmp",
        "mail_smtpmode": "sendmail",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "loglevel": 0,
        "log_type": "file",
        "maintenance": false,
        "theme": "",
        "logfile": "\/media\/data\/ncdata\/nextcloud.log",
        "mail_sendmailmode": "smtp",
        "htaccess.RewriteBase": "\/",
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "app_install_overwrite": [
            "ocsms",
            "cookbook",
            "passwords",
            "whiteboard",
            "previewgenerator",
            "breezedark",
            "nextcloudpi",
            "apporder",
            "deck",
            "health",
            "twofactor_totp",
            "event_update_notification",
            "files_clipboard",
            "music",
            "gpoddersync",
            "uppush",
            "twofactor_gateway",
            "podcast"
        ],
        "data-fingerprint": "***REMOVED SENSITIVE VALUE***",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [
            "Guest"
        ],
        "twofactor_enforced_excluded_groups": [
            "admin"
        ],
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls"
    }
}

HTTPd logs

[Wed Jun 15 00:00:05.216354 2022] [http2:warn] [pid 1094] AH10034: The mpm modul                                                                                                             e (prefork.c) is not supported by mod_http2. The mpm determines how things are p                                                                                                             rocessed in your server. HTTP/2 has more demands in this regard and the currentl                                                                                                             y selected mpm will just not do. This is an advisory warning. Your server will c                                                                                                             ontinue to work, but the HTTP/2 protocol will be inactive.
[Wed Jun 15 00:00:05.293057 2022] [mpm_prefork:notice] [pid 1094] AH00163: Apach                                                                                                             e/2.4.53 (Debian) OpenSSL/1.1.1n   configured -- resuming normal operations
[Wed Jun 15 00:00:05.293127 2022] [core:notice] [pid 1094] AH00094: Command line                                                                                                             : '/usr/sbin/apache2'
[Wed Jun 15 11:21:03.365367 2022] [:error] [pid 1040053] [client ***REMOVED SENSITIVE VALUE***] [client ***REMOVED SENSITIVE VALUE***] ModSecurity: Warning. Match of "rx ^[\\\\w/.+-]+(?:                                                                                                             \\\\s?;\\\\s?(?:action|boundary|charset|type|start(?:-info)?)\\\\s?=\\\\s?['\\"\                                                                                                             \\\w.()+,/:=?<>@-]+)*$" against "REQUEST_HEADERS:Content-Type" required. [file "                                                                                                             /usr/share/modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "                                                                                                             932"] [id "920470"] [msg "Illegal Content-Type header"] [data "%{#context['com.o                                                                                                             pensymphony.xwork2.dispatcher.httpservletresponse'].addheader('yjf3b3px','1')}.m                                                                                                             ultipart/form-data"] [severity "CRITICAL"] [ver "OWASP_CRS/3.3.0"] [tag "applica                                                                                                             tion-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol                                                                                                             "] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/255/153"] [tag "P                                                                                                             CI/12.1"] [hostname "***REMOVED SENSITIVE VALUE***"] [uri "/"] [unique_id "YqmkfyVtx0fTD8Utr0E2                                                                                                             yAAAAAU"]

Database logs

2022-03-10 17:31:55 0 [Note] InnoDB: 10.3.31 started; log sequence number 195628                                                                                                             97830; transaction id 35395886
2022-03-10 17:31:55 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/                                                                                                             ib_buffer_pool
2022-03-10 17:31:55 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-03-10 17:31:55 0 [Note] Server socket created on IP: '127.0.0.1'.
2022-03-10 17:31:55 0 [Note] Reading of all Master_info entries succeeded
2022-03-10 17:31:55 0 [Note] Added new Master_info '' to hash table
2022-03-10 17:31:55 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.31-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3                                                                                                             306  Debian 10
2022-03-10 17:32:07 0 [Note] InnoDB: Buffer pool(s) load completed at 220310 17:                                                                                                             32:07
2022-03-10 22:39:05 0 [Note] /usr/sbin/mysqld (initiated by: unknown): Normal sh                                                                                                             utdown
2022-03-10 22:39:05 0 [Note] Event Scheduler: Purging the queue. 0 events
2022-03-10 22:39:05 0 [Note] InnoDB: FTS optimize thread exiting.
2022-03-10 22:39:05 0 [Note] InnoDB: Starting shutdown...
2022-03-10 22:39:05 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib                                                                                                             _buffer_pool
2022-03-10 22:39:05 0 [Note] InnoDB: Instance 0, restricted to 30720 pages due t                                                                                                             o innodb_buf_pool_dump_pct=25
2022-03-10 22:39:05 0 [Note] InnoDB: Buffer pool(s) dump completed at 220310 22:                                                                                                             39:05
2022-03-10 22:39:11 0 [Note] InnoDB: Removed temporary tablespace data file: "ib                                                                                                             tmp1"
2022-03-10 22:39:11 0 [Note] InnoDB: Shutdown completed; log sequence number 195                                                                                                             85780433; transaction id 35432855
2022-03-10 22:39:11 0 [Note] /usr/sbin/mysqld: Shutdown complete


Nextcloud logs

{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"metadata","method":"","url":"--","message":"/app                                                                                                             info/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on th                                                                                                             e application class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"music","method":"","url":"--","message":"/appinf                                                                                                             o/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the a                                                                                                             pplication class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"ocsms","method":"","url":"--","message":"/appinf                                                                                                             o/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the a                                                                                                             pplication class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"previewgenerator","method":"","url":"--","messag                                                                                                             e":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstr                                                                                                             ap on the application class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Json","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Atom","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Rss","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":0,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Rdf","userAgent":"--","version":"24.0.1.1"}
{"reqId":"8bxJ0PCgH5nBvnqf7FRc","level":1,"time":"2022-06-15T11:03:01+00:00","re                                                                                                             moteAddr":"","user":"--","app":"passwords","method":"","url":"--","message":"Pas                                                                                                             swords runs /var/www/nextcloud/occ in global mode","userAgent":"--","version":"2                                                                                                             4.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"extract","method":"","url":"--","message":"/appi                                                                                                             nfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the                                                                                                              application class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"maps","method":"","url":"--","message":"/appinfo                                                                                                             /app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the ap                                                                                                             plication class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"metadata","method":"","url":"--","message":"/app                                                                                                             info/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on th                                                                                                             e application class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"music","method":"","url":"--","message":"/appinf                                                                                                             o/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the a                                                                                                             pplication class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"ocsms","method":"","url":"--","message":"/appinf                                                                                                             o/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the a                                                                                                             pplication class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"previewgenerator","method":"","url":"--","messag                                                                                                             e":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstr                                                                                                             ap on the application class instead.","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Json","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Atom","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Rss","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":0,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"news","method":"","url":"--","message":"new pars                                                                                                             er added : FeedIo\\Standard\\Rdf","userAgent":"--","version":"24.0.1.1"}
{"reqId":"zkpyry4CeCyTHC5oDWgP","level":1,"time":"2022-06-15T11:03:10+00:00","re                                                                                                             moteAddr":"","user":"--","app":"passwords","method":"","url":"--","message":"Pas                                                                                                             swords runs /var/www/nextcloud/occ in global mode","userAgent":"--","version":"2                                                                                                             4.0.1.1"}

The location of my php.ini file differed.

Just run php --ini and look for Loaded Configuration File in the output for the location of php.ini used by your CLI.

there you can changed the settings for the OPcache module.
For me it was located at /etc/php/7.4/cli/php.ini instead of /etc/php/7.4/apache2/php.ini.

[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=0

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

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

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

; The maximum percentage of "wasted" memory until a restart is scheduled.
opcache.max_wasted_percentage=15

; 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=0

; 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=60

; Enables or disables file search in include_path optimization

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

; 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=0x7FFFBFFF

;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=

; Facilitates multiple OPcache instances per user (for Windows only). All PHP
; processes with the same cache ID and user share an OPcache instance.
;opcache.cache_id=

; 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

; If specified, it produces opcode dumps for debugging different stages of
; optimizations.
;opcache.opt_debug_level=0

; Specifies a PHP script that is going to be compiled and executed at server
; start-up.
; http://php.net/opcache.preload
;opcache.preload=

; Preloading code as root is not allowed for security reasons. This directive
; facilitates to let the preloading to be run as another user.
; http://php.net/opcache.preload_user
;opcache.preload_user=

; Prevents caching files that are less than this number of seconds old. It
; protects from caching of incompletely updated files. In case all file updates
; on your site are atomic, you may increase performance by setting it to "0".
;opcache.file_update_protection=2

; Absolute path used to store shared lockfiles (for *nix only).
;opcache.lockfile_path=/tmp

Still… after a while I get the OPcache warning again, I just don’t get it. :exploding_head:

Now I know what was wrong.
My configuration files are somehow split up and the one which manages the opcache is located at
/etc/php/7.4/cli/conf.d/10-opcache.ini in my case.

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

1 Like

yep… the alert came back…
im lost any luck?

yes, I managed it like I described in my solution. My opcache is located at /etc/php/7.4/cli/conf.d/10-opcache.ini in my case. You have to find the right *.ini file. You can search them with php --ini

2 Likes

In the php conf.d directory, which is loaded after php.ini (well rather it’s included by php.ini - usually at the end of the file) - files are loaded alphanumerically. So last file loaded wins.

If you put a setting in a file that starts with 10- and a file that starts with 11- has the same setting, your setting won’t stick. So installing new modules can change the results folks are getting. And if someone added to php.ini it would matter if it was added before or after the include.

If you want to ensure your changes stick through releases and installs of new modules; add a file to the conf.d directory that starts with multiple lowercase z and it will load last, ensuring your changes override any new defaults.

1 Like