php laravel框架 项目搭建环境运行 composer install 遇到问题

文章描述了在使用Composer安装依赖时遇到的PHP扩展fileinfo和gd缺失的问题,以及如何通过修改php.ini文件启用这些扩展。如果问题仍然存在,可以通过运行特定的Composer命令忽略平台要求来完成安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误代码如下:

Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - league/flysystem is locked to version 1.1.10 and an update of this package was not requested.
    - league/flysystem 1.1.10 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  Problem 2
    - league/mime-type-detection is locked to version 1.11.0 and an update of this package was not requested.
    - league/mime-type-detection 1.11.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  Problem 3
    - phpoffice/phpspreadsheet is locked to version 1.26.0 and an update of this package was not requested.
    - phpoffice/phpspreadsheet 1.26.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  Problem 4
    - league/flysystem 1.1.10 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - league/flysystem-aws-s3-v3 1.0.30 requires league/flysystem ^1.0.40 -> satisfiable by league/flysystem[1.1.10].
    - league/flysystem-aws-s3-v3 is locked to version 1.0.30 and an update of this package was not requested.

To enable extensions, verify that they are enabled in your .ini files:
    - D:\myphp\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.

解决方案:

修改安装的 php 目录下,php.ini 解开 extension=fileinfo 的注释,去点前面的分号即可

 修改完后,在执行 composer install 命令,可能有两种情况如下:

  1. 执行成功,可以进行下一步
  2. 还出现错误,错误代码如下:
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - phpoffice/phpspreadsheet is locked to version 1.26.0 and an update of this package was not requested.
    - phpoffice/phpspreadsheet 1.26.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.

To enable extensions, verify that they are enabled in your .ini files:
    - D:\myphp\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-gd` to temporarily ignore these required extensions.

解决方案如下:

执行下面命令:composer install --ignore-platform-req=ext-gd

执行后就成功了!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值