Clear the Nextcloud OPcache Warning by Adjusting the Right Limit

To clear Nextcloud's “The PHP OPcache is not properly configured” warning, open the full warning in Administration settings → Overview, then increase only the OPcache limit it identifies in the PHP configuration used by the web server. Restart the corresponding PHP service and check the warning again; editing the command-line PHP configuration alone may not change what Nextcloud uses.

For example, if Nextcloud reports that the interned strings buffer is nearly full, raising opcache.interned_strings_buffer from 16 to 32 MB is a reasonable first adjustment when the server has sufficient RAM. A different warning about cached scripts or shared memory calls for a different setting.

Why Nextcloud displays this OPcache warning

OPcache stores compiled PHP bytecode in shared memory, reducing the amount of compilation needed for repeated web requests. It also reserves space for interned strings, which lets PHP reuse identical strings. These capacities are separate limits, so expanding one does not necessarily solve an alert about another.

According to the Nextcloud 35 server-tuning documentation, the administration panel warns when an OPcache size limit exceeds 90% of its allocated capacity. The message may specifically mention an almost-full interned strings buffer, a limited number of cached scripts, or insufficient shared memory. That detail determines the fix.

Nextcloud also requires opcache.save_comments=1, because it depends on preserved PHP code comments. A disabled OPcache extension or disabled comment preservation is therefore a configuration problem, not merely a cache-sizing issue.

1. Identify the setting that needs attention

Sign in as an administrator, navigate to Administration settings → Overview, and read the complete OPcache warning. Record the exact directive if one is named. Do not assume that every OPcache warning means the interned strings buffer is undersized.

  • Interned strings buffer nearly full: check opcache.interned_strings_buffer.
  • OPcache shared memory nearly full: check opcache.memory_consumption.
  • Cached scripts or keys approaching the limit: check opcache.max_accelerated_files.
  • OPcache disabled or comments not preserved: check opcache.enable and opcache.save_comments.

2. Find the PHP configuration serving Nextcloud

On Debian or Ubuntu servers using PHP-FPM, PHP configuration is usually organized by PHP version and server API. For example, PHP 8.3 FPM may read files under /etc/php/8.3/fpm/conf.d/, while Apache's PHP module may use /etc/php/8.3/apache2/conf.d/.

To see which PHP-FPM services exist on a systemd host, run:

systemctl list-units --type=service 'php*-fpm.service'

Check the applicable OPcache files, substituting your installed PHP version:

sudo ls -l /etc/php/8.3/fpm/conf.d/*opcache*
sudo grep -R 'opcache\.' /etc/php/8.3/fpm/conf.d/

If no files are found, inspect the main php.ini and the packaging conventions for your distribution. The command php --ini is useful for identifying CLI PHP configuration, but CLI and PHP-FPM may load different settings.

For Docker or Nextcloud All-in-One, examine PHP configuration inside the Nextcloud container and use a supported persistent configuration method. Editing host /etc/php files usually will not configure PHP inside a container; editing a generated container file may also be undone by recreation.

3. Increase the reported limit without changing unrelated settings

Back up the relevant configuration file before making a change. On a conventional Debian/Ubuntu PHP-FPM installation, one maintainable approach is to add a local override under that PHP version's FPM conf.d directory. Confirm that this directory is actually loaded by your PHP-FPM installation before proceeding.

For the interned strings buffer example, create or edit a local override such as /etc/php/8.3/fpm/conf.d/99-nextcloud-opcache.ini:

; Example for a warning about interned strings
opcache.interned_strings_buffer=32

Here, 32 means 32 MB, not 32 bytes. Size the final value to actual usage and available RAM.

If the warning instead names a different limit, use the corresponding example instead of blindly adding all three:

; Example only: larger shared bytecode cache
opcache.memory_consumption=256

; Example only: allow more cached script keys
opcache.max_accelerated_files=20000

Values for opcache.memory_consumption are in megabytes, whereas opcache.max_accelerated_files specifies a script-key limit. The official PHP OPcache configuration reference explains their units, defaults, and changeability.

When the warning points to disabled OPcache or missing comments rather than capacity, verify these settings instead:

opcache.enable=1
opcache.save_comments=1

Do not switch off opcache.validate_timestamps or substantially lengthen opcache.revalidate_freq just to dismiss this warning. Nextcloud cautions that delayed cache revalidation can prevent configuration and upgrade changes from taking effect promptly.

4. Apply the new configuration

For an example server running PHP 8.3 through PHP-FPM, first validate the service configuration, then restart the matching service during a brief maintenance window:

sudo php-fpm8.3 -t
sudo systemctl restart php8.3-fpm

Replace 8.3 with the installed PHP-FPM version and confirm the executable and service name before running either command. A restart interrupts requests handled by that pool. On Apache with mod_php, the relevant service is Apache rather than PHP-FPM; for containers, apply your deployment's documented restart or recreation procedure while preserving configuration.

If the service fails to restart, restore your backed-up configuration and inspect the PHP-FPM or web-server error log.

5. If the warning remains, check the effective web PHP settings

First reload Administration settings → Overview after the PHP workers have restarted. If the same warning persists, verify that the changed directive is actually loaded by the web PHP runtime, not just the CLI. Check for a later-loading .ini file or a PHP-FPM pool override that supersedes your value.

On a server you control, you can temporarily inspect web PHP values using a narrowly access-restricted diagnostic endpoint and PHP's ini_get() function. Never leave a public phpinfo() page online: it can reveal environment, paths, modules, and other sensitive configuration details. Remove any diagnostic endpoint immediately after verification.

For a persistent sizing alert, inspect actual OPcache use under normal traffic rather than repeatedly doubling values. The PHP opcache_get_status() documentation describes the memory, interned-string, and cached-script statistics available to a running PHP process.

Nextcloud's official Docker image and All-in-One deployments carry their own PHP defaults; do not assume host-level edits or another installation's recommended values will persist. Consult the official Nextcloud Docker repository or official All-in-One repository for the configuration model matching your deployment.

Verify that the fix worked

Return to Administration settings → Overview and confirm that the specific OPcache warning is gone. Open and reload a few Nextcloud pages to make sure the application still responds normally. If the warning returns after regular use, recheck the same measured limit and the effective web PHP configuration; the goal is to leave sufficient headroom without assigning unnecessary memory to OPcache.

Leave a Comment

Tame Nextcloud Preview CPU Spikes with a Scheduled Queue

Move thumbnail work to a controlled background schedule, trim unused preview sizes, and verify the queue without overwhelming your Nextcloud server.

Get Nextcloud Desktop Sync Moving Past “Processing Files”

Find the file, exclusion rule, connection issue, or client database state holding up Nextcloud sync, then verify uploads and downloads safely.

Clear the Nextcloud OPcache Warning by Adjusting the Right Limit

Find the PHP OPcache limit triggering Nextcloud’s warning, update the correct web PHP configuration, restart safely, and verify the result.

Connect Nextcloud to CODE Docker: Setup and Tradeoffs

Connect Nextcloud to CODE Docker: Setup and Tradeoffs

Compare built-in and Docker-based CODE, then connect Collabora Online to Nextcloud through a secure HTTPS reverse proxy.

Build a Resilient Nextcloud Cluster with Galera

Plan a reliable Nextcloud HA deployment with shared storage, Redis locking, quorum-aware MariaDB routing, and practical failover checks.

Get Nextcloud Talk Calls Through When Direct Media Fails

Get Nextcloud Talk Calls Through When Direct Media Fails

Configure and verify a reachable TURN relay for Nextcloud Talk when firewalls or restrictive NAT block direct call media.

Clear Nextcloud Integrity Warnings by Restoring the Right Files

Use the invalid-file report to identify changed, missing, or extra Nextcloud code, restore trusted files safely, and verify the result.

Connect Gmail or Microsoft 365 to Nextcloud Mail Using OAuth2

Set up OAuth2 for Nextcloud Mail with Gmail or Microsoft 365, verify receiving and sending, and resolve common consent and SMTP failures.

Clear Stuck Nextcloud Maintenance Mode Safely With OCC

Clear Stuck Nextcloud Maintenance Mode Safely With OCC

Use OCC to restore Nextcloud access, verify database migration status, and choose the right command for archive, Docker, or Snap installs.

Set Up Nextcloud LDAP and Active Directory Login

Connect Nextcloud to LDAP or Active Directory, limit access with user and group filters, and verify secure authentication before rollout.