{
  "id": "nginx/fastcgi-primary-script-unknown",
  "signature": "FastCGI sent in stderr: \"Primary script unknown\" while reading response header from upstream",
  "signature_zh": "FastCGI 在 stderr 中发送“主脚本未知”",
  "regex": "Primary script unknown",
  "domain": "nginx",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The FastCGI server cannot find the script file specified by the SCRIPT_FILENAME parameter, often due to incorrect root or try_files configuration.",
  "root_cause_type": "generic",
  "root_cause_zh": "FastCGI 服务器找不到 SCRIPT_FILENAME 参数指定的脚本文件，通常是由于 root 或 try_files 配置错误。",
  "versions": [
    {
      "version": "nginx 1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.22.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.20.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP-FPM 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP-FPM 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The socket path must match the actual FastCGI server listener; the error is about script not found, not connection.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the root is wrong, the script path will still be incorrect.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "fastcgi_params does not set SCRIPT_FILENAME; you need fastcgi_index or explicit fastcgi_param.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the root directive points to the correct document root and set SCRIPT_FILENAME explicitly: `fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;`",
      "success_rate": 0.9,
      "how": "Ensure the root directive points to the correct document root and set SCRIPT_FILENAME explicitly: `fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use try_files to pass the request to the front controller: `try_files $uri $uri/ /index.php?$query_string;` and then set fastcgi_index index.php;",
      "success_rate": 0.85,
      "how": "Use try_files to pass the request to the front controller: `try_files $uri $uri/ /index.php?$query_string;` and then set fastcgi_index index.php;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check that the script file exists on the filesystem with correct permissions. Run: `ls -la /path/to/root/index.php`",
      "success_rate": 0.95,
      "how": "Check that the script file exists on the filesystem with correct permissions. Run: `ls -la /path/to/root/index.php`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the root directive points to the correct document root and set SCRIPT_FILENAME explicitly: `fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;`",
    "Use try_files to pass the request to the front controller: `try_files $uri $uri/ /index.php?$query_string;` and then set fastcgi_index index.php;",
    "Check that the script file exists on the filesystem with correct permissions. Run: `ls -la /path/to/root/index.php`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-07-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}