{
  "id": "php/openssl-random-pseudo-bytes-seed",
  "signature": "Warning: openssl_random_pseudo_bytes(): Seed could not be generated in /var/www/app/src/Security/TokenGenerator.php on line 23",
  "signature_zh": "警告：openssl_random_pseudo_bytes()：种子无法生成，位于 /var/www/app/src/Security/TokenGenerator.php 第 23 行",
  "regex": "/Warning: openssl_random_pseudo_bytes\\(\\): Seed could not be generated/",
  "domain": "php",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "The OpenSSL random number generator cannot gather enough entropy to seed, typically due to a missing or empty /dev/urandom on the system, or a restrictive open_basedir configuration.",
  "root_cause_type": "generic",
  "root_cause_zh": "OpenSSL 随机数生成器无法收集足够的熵来播种，通常是由于系统中缺少或空的 /dev/urandom，或受限制的 open_basedir 配置。",
  "versions": [
    {
      "version": "PHP 7.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing PHP's memory_limit or max_execution_time hoping the random generation will complete",
      "why_fails": "The error is about entropy availability, not memory or time; the system simply cannot gather enough random data.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Installing haveged or rng-tools without verifying they are actually running and providing entropy",
      "why_fails": "The service might be installed but not started, or the entropy source might be blocked by virtualization or container restrictions.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check if /dev/urandom exists and is readable: `ls -la /dev/urandom`. If missing, create it: `sudo mknod -m 644 /dev/urandom c 1 9 && sudo chmod 644 /dev/urandom`. Then restart PHP-FPM.",
      "success_rate": 0.8,
      "how": "Check if /dev/urandom exists and is readable: `ls -la /dev/urandom`. If missing, create it: `sudo mknod -m 644 /dev/urandom c 1 9 && sudo chmod 644 /dev/urandom`. Then restart PHP-FPM.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If in a Docker container, ensure the container has access to the host's entropy pool by adding `--privileged` or mounting `/dev/urandom` from the host: `docker run -v /dev/urandom:/dev/urandom ...`",
      "success_rate": 0.85,
      "how": "If in a Docker container, ensure the container has access to the host's entropy pool by adding `--privileged` or mounting `/dev/urandom` from the host: `docker run -v /dev/urandom:/dev/urandom ...`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check if /dev/urandom exists and is readable: `ls -la /dev/urandom`. If missing, create it: `sudo mknod -m 644 /dev/urandom c 1 9 && sudo chmod 644 /dev/urandom`. Then restart PHP-FPM.",
    "If in a Docker container, ensure the container has access to the host's entropy pool by adding `--privileged` or mounting `/dev/urandom` from the host: `docker run -v /dev/urandom:/dev/urandom ...`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/function.openssl-random-pseudo-bytes.php",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-09-25",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}