ext-imagick * -> 您的系统中缺少请求的 PHP 扩展 imagick


ext-imagick * -> the requested PHP extension imagick is missing from your system

我在为 laravel安装 devisephp 时遇到问题。我正在使用php7开发最新版本的homestead。当我进行作曲家更新时,出现以下错误。

Problem 1
    - Installation request for devisephp/cms 1.4.* -> satisfiable by devisephp/cms[1.4.0].
    - devisephp/cms 1.4.0 requires ext-imagick * -> the requested PHP extension imagick is missing from your system.

收到此消息后,我在我的宅基地环境中安装了 imagick,在 cli 和 fpm 中将扩展添加到 php.ini 中,并在 imagick 正在使用测试文件时检查 homestead。一切都运行良好,但在运行作曲家更新时,我仍然从上面收到相同的错误消息。有没有人知道问题可能是什么。

斯坦格的事情是,kan git clone 设计了它的引导程序版本完全工作,包括图像处理,但是当我向 laravel 添加另一个包时,我再次收到上述消息。

如果您确实无法安装或不希望验证该扩展,您可以通过提供

--ignore-platform-reqs

标记到作曲家命令

请按照以下步骤操作

  • sudo apt-get install php-imagick
  • PHP -m | grep imagick//这应该打印"imagick",这意味着安装正确
  • sudo service apache2 restart//(如果需要)

尝试添加:

"ext-imagick": "*",

到你的 composer.json 中的 require 块,如下所示:

"license": "MIT",
"require": {
    "ext-imagick": "*",
    ....
}

并运行作曲家更新

使用 composer 中的 config.platform 键.js您可以伪造 php 版本或扩展等依赖项(不过,您不能对扩展版本使用星号!https://getcomposer.org/doc/06-config.md#platform

作为奖励,您可以使用此库填充ext-imagick:https://github.com/calcinai/php-imagick.它不完整,依赖于命令行ImageMagick。到目前为止,它对我有用。

{
    "require": {
        "calcinai/php-imagick": "dev-master"
    },
    "config": {
      "platform":{
        "ext-imagick": "3.4.4"
        }
    }
}
如果您

使用的是Mac,则步骤如下:

  1. 安装映像魔术依赖项。

    brew install pkg-config imagemagick

  2. 使用 pecl 编译 Imagick PHP 扩展

    pecl install imagick

  3. 验证安装。

    php -m | grep -i magic

    你会看到imagick.