Guide
Nextcloud "The OPcache interned strings buffer is nearly full"
Nextcloud warns when the buffer is over 90 percent full, but only while the buffer is smaller than a quarter of the whole OPcache. We read the check in the source, ran the official Nextcloud 35 image at 128 MB and 512 MB, and timed when the warning clears.
What should opcache.interned_strings_buffer be set to for Nextcloud?
At least a quarter of opcache.memory_consumption: 32 for 128, 64 for 256, 128 for 512. Nextcloud only warns while the buffer is smaller than that quarter and more than 90 percent full, so at a quarter or more the warning cannot appear. In the official Docker image, put the value in a mounted .ini file in /usr/local/etc/php/conf.d/, because no environment variable sets it. Then restart the container.
Set opcache.interned_strings_buffer to at least a quarter of opcache.memory_consumption. That is 32 for 128, 64 for 256 and 128 for 512. Nextcloud only shows this warning while the buffer is smaller than that quarter, so at a quarter or more it cannot appear. In the official Docker image, no environment variable sets the buffer, so mount a file:
; zz-opcache.ini, mounted at /usr/local/etc/php/conf.d/zz-opcache.ini
opcache.interned_strings_buffer=64services:
app:
image: nextcloud:apache
environment:
PHP_OPCACHE_MEMORY_CONSUMPTION: 256
volumes:
- ./zz-opcache.ini:/usr/local/etc/php/conf.d/zz-opcache.ini:roThen restart the container. PHP reads this setting only at start.
The terms this answer turns on#
OPcache is the part of PHP that keeps compiled scripts in shared memory. Without it, PHP would read and compile Nextcloud's thousands of files on every request. Its total size is opcache.memory_consumption, in megabytes. PHP's default is 128.
Interned strings are text that appears again and again in code: class names, function names, array keys. OPcache keeps one shared copy of each instead of a copy per script.
The interned strings buffer is the space set aside for those copies, opcache.interned_strings_buffer, also in megabytes. The PHP manual gives its default as 8. It is not extra memory. In our lab the OPcache's used and free memory added up to exactly memory_consumption, with the buffer counted inside it. So at 128 and 32, compiled scripts get about 96 MiB.
When the buffer is full, PHP still runs. New strings simply stop being shared. That is why this is a warning, not an error.
What the check actually tests#
The check is in PhpOpcacheSetup.php in Nextcloud's settings app. It reads both settings and the live usage from opcache_get_status(). It warns only when both of these are true:
- The buffer is smaller than a quarter of
memory_consumption. The comment in the code says why: do not recommend raising the buffer "above a quarter of the total OPcache size". - Used memory divided by free memory is more than 9, or free memory is zero. Used over free above 9 means more than 90 percent full.
The message quotes your current value: "it is recommended to apply "opcache.interned_strings_buffer" to your PHP configuration with a value higher than "32"". It does not say how much higher. The admin manual only says a warning appears when an OPcache limit "exceeds 90% of its allocated size". Neither one mentions the quarter, and that is why forum answers range from 16 to 64 with no rule behind them.
So "32 for 128" is not a guess. It is the point where the first condition stops being true.
Why Docker users only see it after raising memory#
Both popular images set the two values to exactly a quarter:
| Install | Buffer | Memory | Can you change it? | Can the warning appear as shipped? |
|---|---|---|---|---|
Official nextcloud image (35) | 32 | 128 | Memory: PHP_OPCACHE_MEMORY_CONSUMPTION. Buffer: no variable | No, 32 is not under 128 / 4 |
LinuxServer nextcloud | 32 | 128 | Neither has a variable. Use /config/php/php-local.ini | No |
| TrueNAS app | 32 (minimum 32) | 128 | Both are fields in the app's settings | No |
| PHP with no OPcache settings | 8 | 128 | Your php.ini | Yes, 8 is under 32 |
The official Dockerfile writes opcache.interned_strings_buffer=32 and opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION} into opcache-recommended.ini, with the variable set to 128. Raise that one variable to 256 and the quarter becomes 64. The buffer is still 32, so the first condition is now true. The warning then appears as soon as the buffer passes 90 percent.
The LinuxServer image writes both values, 32 and 128, into 00_opcache.ini with no variable for either. So it stays quiet unless you change the memory value yourself. Its base image creates /config/php/php-local.ini, which says "Edit this file to override php.ini directives". Change both values there, at the same quarter ratio, and restart the container.
That is also the tell in the TrueNAS thread. The poster saw "a value higher than "32"". With a buffer of 32, the check can only run when memory is above 128. The TrueNAS app now has a field for each value. The buffer field starts at 32 and will not go lower. The fix there is the same: keep the buffer at a quarter of the memory field.
Raising memory does not make the warning appear on its own. It makes it possible. Whether it appears depends on how full the buffer gets, which the next section measured.
What we measured#
We ran nextcloud:apache (Nextcloud 35.0.2, PHP 8.5.12, Apache) with SQLite on Docker Engine 28.1.1. After install, we loaded 13 pages as the admin: Files, Dashboard, Photos, Activity, settings pages and WebDAV. Then we read opcache_get_status() through Apache and fetched the setup check from /settings/setupcheck.
| Setup | Buffer used after the UI | Setup check |
|---|---|---|
| Image default, 128 and 32 | 14.58 MB of 33.55 MB (43%) | Correctly configured |
PHP_OPCACHE_MEMORY_CONSUMPTION=512, buffer 32 | 14.58 MB of 33.55 MB (43%) | Correctly configured |
| Same, plus 12 more apps (63 enabled) and their pages | 18.04 MB of 33.55 MB (54%) | Correctly configured |
| 128 and buffer 8 (PHP's default) | 8.39 MB of 8.39 MB, 0 bytes free | Warning, "higher than "8"" |
The 12 apps were Calendar, Contacts, Mail, Deck, Notes, Tasks, Talk, Forms, Polls, Nextcloud Office, Bookmarks and News.
Two things follow. First, 32 is plenty for a typical instance: even 63 apps used just over half of it. Second, at 512 the check was open and still quiet, because the buffer never got near 90 percent. An instance that does warn at 32 is holding more strings than our lab did.
The buffer of 8 is the bare-metal case. After a restart, the setup check request alone pushed it past 90 percent and warned. One pass through the UI left 0 bytes free.
When the warning clears#
PHP reads the buffer size once, when it starts. We tested this on the buffer-8 container by changing its mounted file to 32:
| Step | ini_get inside Apache | Setup check |
|---|---|---|
| File changed, nothing restarted | 8 | Warning |
apache2ctl -k graceful inside the container | 32 | Correctly configured |
docker restart, then the UI loaded again | 32 | Correctly configured |
With the file in place, docker compose restart app is the simple route. On a PHP-FPM install, restart the FPM service. Set the value in php.ini or a conf.d file. The PHP manual says that from PHP 8.5, changing memory_consumption in a pool with php_admin_value fails and logs a warning.
Do not check with occ setupchecks. The command line has its own OPcache, and the check skips itself there. PHP's default for opcache.enable_cli is 0, and our lab printed "Checking from CLI, OPcache checks have been skipped."
A worked case: memory raised to 256#
Take the official image with PHP_OPCACHE_MEMORY_CONSUMPTION=256 in the compose file. Say it was raised because of the other OPcache warning, "The OPcache buffer is nearly full". The buffer is still the image's 32.
A quarter of 256 is 64, and 32 is under that, so the check is open. Ninety percent of 32 MiB is 28.8 MiB. Suppose a large set of apps pushes the buffer past that. The overview now says to raise the buffer "higher than "32"".
Write opcache.interned_strings_buffer=64 into zz-opcache.ini, mount it as above and run docker compose up -d, which recreates the container with the new mount. PHP now starts with 64. Since 64 is not under 64, the check cannot fire again, whatever the usage. The script cache gives up the extra 32 MiB, leaving 192 MiB of the 256.
The name matters. The PHP manual says PHP scans the .ini files in a directory "in alphabetical order", and a later file overrides an earlier one. zz- sorts after opcache-recommended.ini. Our lab file was zz-interned.ini, and ini_get returned its value.
How to see the real numbers#
The setup check gives a yes or no. To see how full the buffer is, ask the serverinfo app, which ships with Nextcloud:
curl -s -u admin:APP_PASSWORD -H 'OCS-APIRequest: true' \
'https://cloud.example.com/ocs/v2.php/apps/serverinfo/api/v1/info?format=json'Under ocs.data.server.php.opcache, interned_strings_usage shows buffer_size, used_memory and free_memory in bytes. These come from the web server's PHP, so they are the numbers the check reads. Load a few pages first: right after a restart, the cache is close to empty.
What this does not cover#
The quarter rule stops the warning. It does not prove the buffer is big enough. At a quarter or more, Nextcloud never reports a full buffer, even when it is full. If you want to know, read free_memory from the API above. The other OPcache warnings come from separate checks and need their own fixes: a full script cache, max_accelerated_files, revalidate_freq and save_comments. We tested only the Apache variant of the official image. The LinuxServer and TrueNAS values come from their build files, not from a lab run. All-in-One sets PHP its own way and is not covered.
What to do next#
Set the buffer to a quarter of your memory value, restart, and load the overview page. If that page also shows the background jobs warning, Nextcloud in Docker: running cron.php for background jobs adds the cron container. If an environment variable seems to have no effect, Why .env variables do not reach the container shows where Compose drops it. The Nextcloud profile covers what the rest of the stack costs to run.
Questions#
Why does Nextcloud say the interned strings buffer should be higher than 32?
Because opcache.memory_consumption is set above 128. The check only runs while the buffer is smaller than a quarter of memory_consumption, and 32 is exactly a quarter of 128. So a warning naming 32 means someone raised the memory, usually with PHP_OPCACHE_MEMORY_CONSUMPTION in the official image or the Op Cache setting in the TrueNAS app, and the buffer then passed 90 percent full. Raise the buffer to a quarter of the new memory value.
Is there an environment variable for interned_strings_buffer in the Nextcloud Docker image?
No. The official image's Dockerfile has PHP_OPCACHE_MEMORY_CONSUMPTION, PHP_MEMORY_LIMIT and PHP_UPLOAD_LIMIT. The buffer is written as a fixed opcache.interned_strings_buffer=32 in opcache-recommended.ini. To change it, mount your own .ini file into /usr/local/etc/php/conf.d/ with a name that sorts after that file, such as zz-opcache.ini.
Why does occ setupchecks not show the OPcache warning?
occ runs PHP from the command line, which has its own OPcache, usually turned off. The check skips itself there and prints "Checking from CLI, OPcache checks have been skipped." Our lab printed exactly that line. Read the warning on the Administration overview page, or read the numbers from the serverinfo API.
Does the interned strings buffer use extra RAM on top of memory_consumption?
No. In our lab the OPcache's used and free memory added up to exactly memory_consumption, 128 MiB and 512 MiB, with the 32 MiB buffer counted inside it. So raising the buffer to a quarter takes that space from the script cache. At 128 and 32, about 96 MiB is left for compiled scripts. A fresh Nextcloud 35 used about 55 MiB of it after we loaded the web UI.
I changed the setting and the warning is still there. Why?
PHP reads this setting only when it starts. In our lab the new file was visible inside the container, but the web check kept warning and ini_get still returned 8 until we restarted. docker compose restart app works. So does apache2ctl -k graceful inside the Apache image. On PHP-FPM, restart the FPM service.
Sources#
- Nextcloud server 35, PhpOpcacheSetup.php (the setup check)
- nextcloud/docker, 35/apache/Dockerfile (opcache-recommended.ini)
- linuxserver/docker-nextcloud, Dockerfile (00_opcache.ini)
- linuxserver/docker-baseimage-alpine-nginx 3.24, init-php (php-local.ini)
- TrueNAS apps, Nextcloud questions.yaml (Op Cache settings)
- TrueNAS forum, "Nextcloud: opcache.interned_strings_buffer value to low"
- PHP manual, OPcache runtime configuration
- Nextcloud admin manual, server tuning (OPcache sizing)
Published . Last reviewed . Found something out of date? Tell us and we will fix it and log the change.