{
  "id": "php/opcache-interned-strings-buffer",
  "signature": "Warning: PHP Startup: Unable to allocate interned strings buffer: 2097152 bytes in Unknown on line 0",
  "signature_zh": "警告：PHP 启动：无法分配内部字符串缓冲区：2097152 字节，位于 Unknown 第 0 行",
  "regex": "Warning: PHP Startup: Unable to allocate interned strings buffer: \\d+ bytes in Unknown on line 0",
  "domain": "php",
  "category": "system_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "OPcache 的内部字符串缓冲区太大，超出了可用的共享内存，通常是由于 `opcache.interned_strings_buffer` 配置值超过了系统的共享内存限制。",
  "versions": [
    {
      "version": "PHP 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OPcache 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OPcache 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is about allocation failure; increasing the value increases memory demand.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error only affects startup; disabling OPcache is unnecessary if the buffer size is adjusted.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The issue is a persistent configuration problem, not a transient system state.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Reduce `opcache.interned_strings_buffer` in php.ini to a smaller value, e.g., from 16 to 8: `opcache.interned_strings_buffer = 8`",
      "success_rate": 0.9,
      "how": "Reduce `opcache.interned_strings_buffer` in php.ini to a smaller value, e.g., from 16 to 8: `opcache.interned_strings_buffer = 8`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the system shared memory limit by modifying `/etc/sysctl.conf` with `kernel.shmmax = 2147483648` and `kernel.shmall = 2097152`, then reload with `sysctl -p`.",
      "success_rate": 0.75,
      "how": "Increase the system shared memory limit by modifying `/etc/sysctl.conf` with `kernel.shmmax = 2147483648` and `kernel.shmall = 2097152`, then reload with `sysctl -p`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.85,
      "how": "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.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 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。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.interned-strings-buffer",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-08-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}