composer报错:The requested PHP extension ext-bcmath * is missing from your system. Install or enable

本文详细介绍了如何解决Composer在安装Yii2-mongodb扩展时遇到的bcmath和mcrypt扩展缺失的问题。通过检查PHP版本,安装对应版本的扩展,重启PHP服务,并验证扩展是否成功加载,确保开发环境正常运行。

解决compose报错:The requested PHP extension ext-bcmath * is missing from your system. Install or enable PHP's bcmath extension.

报错

在这里插入图片描述

$ composer require --prefer-dist yiisoft/yii2-mongodb                            
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.1 for yiisoft/yii2-mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-bcmath * is missing from your system. Install or enable PHP's bcmath extension.
  Problem 2
    - The requested PHP extension ext-mcrypt * is missing from your system. Install or enable PHP's mcrypt extension.


Installation failed, reverting ./composer.json to its original content.

解决方案:安装php的bcmath扩展

1. 首先查看自己php版本

php -v

2. 安装对应版本的扩展

yum  -y install php72w-bcmath

注意:72w是代表7.2版本,安装的时候记得标明版本号

3. 安装完成后,重启下php

service php-fpm restart  或  systemctl restart php-fpm

4. 查看php扩展是否安装成功

php -m

在这里插入图片描述

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 - Root composer.json requires PHP extension ext-redis * but it is missing from your system. Install or enable PHP's redis extension. Problem 2 - endroid/qrcode is locked to version 3.6.0 and an update of this package was not requested. - endroid/qrcode 3.6.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 3 - fastknife/ajcaptcha is locked to version v1.1.5 and an update of this package was not requested. - fastknife/ajcaptcha v1.1.5 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 4 - intervention/image is locked to version 2.7.2 and an update of this package was not requested. - intervention/image 2.7.2 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 5 - league/flysystem is locked to version 1.0.69 and an update of this package was not requested. - league/flysystem 1.0.69 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 6 - mpdf/mpdf is locked to version v8.0.6 and an update of this package was not requested. - mpdf/mpdf v8.0.6 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 7 - overtrue/wechat is locked to version 4.2.20 and an update of this package was not requested. - overtrue/wechat 4.2.20 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 8 - setasign/fpdf is locked to version 1.8.4 and an update of this package was not requested. - setasign/fpdf 1.8.4 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 9 - simplesoftwareio/simple-qrcode is locked to version 4.2.0 and an update of this package was not requested. - simplesoftwareio/simple-qrcode 4.2.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension. Problem 10 - symfony/translation is locked to version v6.0.0 and an update of this package was not requested. - symfony/translation v6.0.0 requires php >=8.0.2 -> your php version (7.4.0) does not satisfy that requirement. Problem 11 - symfony/translation-contracts is locked to version v3.0.0 and an update of this package was not requested. - symfony/translation-contracts v3.0.0 requires php >=8.0.2 -> your php version (7.4.0) does not satisfy that requirement. Problem 12 - cache/filesystem-adapter is locked to version 1.0.0 and an update of this package was not requested. - cache/filesystem-adapter 1.0.0 requires league/flysystem ^1.0 -> satisfiable by league/flysystem[1.0.69]. - league/flysystem 1.0.69 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. To enable extensions, verify that they are enabled in your .ini files: - E:\software\php\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-redis --ignore-platform-req=ext-gd --ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
最新发布
08-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值