需要 ext-fileinfo.如何将其添加到我的 composer.json 文件中?

2022-01-21 00:00:00 php laravel composer-php

我正在尝试安装干预/图像.运行作曲家更新后,我得到:

I am trying to install intervention/image. After running the composer update, I get:

这是我的作曲家文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "laravel/framework": "4.1.*",
        "intervention/image": "2.*"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

推荐答案

与你的 composer.json 无关.

Nothing to do with your composer.json.

您需要安装 &启用 FileInfo PHP 扩展,从 PHP 5.3.0 开始默认安装.5.3+ 之前的版本可能会使用 已停产的 PECL 扩展.

You need to install & enable FileInfo PHP extension, which is installed by default starting with PHP 5.3.0. Versions prior to 5.3+ may use the discontinued PECL extension.

要启用 FileInfo 扩展,您需要编辑 php.ini 并更改一行.

To enable FileInfo extension, you need to edit your php.ini and change a single line.

  1. 定位线:

  1. Locate the line:

;extension=php_fileinfo.dll

  • 去掉开头的注释:

  • Remove the starting comment:

    extension=php_fileinfo.dll
    

  • <小时>

    要找出您的 php.ini 所在的位置,您可以从终端运行以下命令:


    To find out where your php.ini is located, you can run the following command from a terminal:

    $ php --ini
    

    然后搜索加载的配置文件".

    请注意,PHP CLI 可以加载与 Web 不同的 php.ini 文件,因此不要依赖 phpinfo() 中提供的路径.在终端中运行上面指定的命令,找出 PHP CLI 加载的文件.

    Please note that the PHP CLI can load a different php.ini file than the web, so don't rely on the path provided in phpinfo(). Run the command specified above in a terminal to find out the file loaded by PHP CLI.

    相关文章