{
  "id": "php/imagick-extension-missing",
  "signature": "Fatal error: Uncaught Error: Class 'Imagick' not found in /var/www/app/src/Image/ThumbnailGenerator.php:25",
  "signature_zh": "致命错误：未捕获的错误：在 /var/www/app/src/Image/ThumbnailGenerator.php:25 中找不到类 'Imagick'",
  "regex": "Class 'Imagick' not found",
  "domain": "php",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "The Imagick PHP extension is not installed or enabled on the server, so PHP cannot load the Imagick class for image manipulation.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器上未安装或未启用 Imagick PHP 扩展，因此 PHP 无法加载用于图像处理的 Imagick 类。",
  "versions": [
    {
      "version": "php:8.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "php:8.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "php:8.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Installing the imagick package via Composer (e.g., 'composer require imagick/imagick') does not install the underlying C extension; it only provides a PHP wrapper that still requires the extension to be installed at the system level.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Adding 'extension=imagick.so' to php.ini without first installing the ImageMagick libraries (libmagickcore-dev, libmagickwand-dev) results in a PHP startup warning and the extension fails to load.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Running 'php -m | grep imagick' to check if the extension is loaded, but the check may show it's missing even if the system has ImageMagick installed, because the PHP extension is a separate package.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install the Imagick extension on Ubuntu/Debian: 'sudo apt-get install php-imagick' or for a specific PHP version 'sudo apt-get install php8.2-imagick'. Then restart the web server: 'sudo systemctl restart apache2' or 'sudo systemctl restart php8.2-fpm'.",
      "success_rate": 0.95,
      "how": "Install the Imagick extension on Ubuntu/Debian: 'sudo apt-get install php-imagick' or for a specific PHP version 'sudo apt-get install php8.2-imagick'. Then restart the web server: 'sudo systemctl restart apache2' or 'sudo systemctl restart php8.2-fpm'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using a Docker container, add to your Dockerfile: 'RUN apt-get update && apt-get install -y libmagickwand-dev && pecl install imagick && docker-php-ext-enable imagick'",
      "success_rate": 0.9,
      "how": "If using a Docker container, add to your Dockerfile: 'RUN apt-get update && apt-get install -y libmagickwand-dev && pecl install imagick && docker-php-ext-enable imagick'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Verify installation by creating a PHP file with '<?php phpinfo(); ?>' and searching for 'imagick' in the output, or run 'php -m | grep imagick' from the command line.",
      "success_rate": 0.85,
      "how": "Verify installation by creating a PHP file with '<?php phpinfo(); ?>' and searching for 'imagick' in the output, or run 'php -m | grep imagick' from the command line.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 Ubuntu/Debian 上安装 Imagick 扩展：'sudo apt-get install php-imagick' 或针对特定 PHP 版本 'sudo apt-get install php8.2-imagick'。然后重启 Web 服务器：'sudo systemctl restart apache2' 或 'sudo systemctl restart php8.2-fpm'。",
    "如果使用 Docker 容器，在 Dockerfile 中添加：'RUN apt-get update && apt-get install -y libmagickwand-dev && pecl install imagick && docker-php-ext-enable imagick'",
    "通过创建包含 '<?php phpinfo(); ?>' 的 PHP 文件并在输出中搜索 'imagick'，或从命令行运行 'php -m | grep imagick' 来验证安装。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/imagick.installation.php",
  "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-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}