php
system_error
ai_generated
true
Warning: PHP Startup: Unable to allocate interned strings buffer: 2097152 bytes in Unknown on line 0
ID: php/opcache-interned-strings-buffer
90%Fix Rate
88%Confidence
1Evidence
2023-08-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| PHP 8.0 | active | — | — | — |
| PHP 8.1 | active | — | — | — |
| PHP 8.2 | active | — | — | — |
| PHP 8.3 | active | — | — | — |
| OPcache 8.0 | active | — | — | — |
| OPcache 8.1 | active | — | — | — |
Root Cause
OPcache's interned strings buffer is too large for the available shared memory, typically due to a misconfigured `opcache.interned_strings_buffer` value exceeding the system's shared memory limits.
generic中文
OPcache 的内部字符串缓冲区太大,超出了可用的共享内存,通常是由于 `opcache.interned_strings_buffer` 配置值超过了系统的共享内存限制。
Official Documentation
https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.interned-strings-bufferWorkarounds
-
90% success Reduce `opcache.interned_strings_buffer` in php.ini to a smaller value, e.g., from 16 to 8: `opcache.interned_strings_buffer = 8`
Reduce `opcache.interned_strings_buffer` in php.ini to a smaller value, e.g., from 16 to 8: `opcache.interned_strings_buffer = 8`
-
75% success Increase the system shared memory limit by modifying `/etc/sysctl.conf` with `kernel.shmmax = 2147483648` and `kernel.shmall = 2097152`, then reload with `sysctl -p`.
Increase the system shared memory limit by modifying `/etc/sysctl.conf` with `kernel.shmmax = 2147483648` and `kernel.shmall = 2097152`, then reload with `sysctl -p`.
-
85% success Check available shared memory with `ipcs -lm` and adjust `opcache.interned_strings_buffer` to a value that fits within the system limits; a safe starting point is 4 MB.
Check available shared memory with `ipcs -lm` and adjust `opcache.interned_strings_buffer` to a value that fits within the system limits; a safe starting point is 4 MB.
中文步骤
在 php.ini 中将 `opcache.interned_strings_buffer` 减小到较小的值,例如从 16 改为 8:`opcache.interned_strings_buffer = 8`
通过修改 `/etc/sysctl.conf` 增加系统共享内存限制:`kernel.shmmax = 2147483648` 和 `kernel.shmall = 2097152`,然后使用 `sysctl -p` 重新加载。
使用 `ipcs -lm` 检查可用共享内存,并将 `opcache.interned_strings_buffer` 调整为适合系统限制的值;安全起始值为 4 MB。
Dead Ends
Common approaches that don't work:
-
95% fail
The error is about allocation failure; increasing the value increases memory demand.
-
60% fail
The error only affects startup; disabling OPcache is unnecessary if the buffer size is adjusted.
-
90% fail
The issue is a persistent configuration problem, not a transient system state.