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

The requested PHP extension exit-BCMath * is missing from your system. Install or enable PHP’s BCMath extension. The requested PHP extension exit-BCMath * is missing from your system.
Install the PHP BCMath extension 1. First check your own PHP version 2. After the installation is complete, restart php4. Check to see if the PHP extension is installed successfully

An error

$ 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.

Solution: Install the BCMath extension for PHP
1. Check your own version of PHP first

php -v

2. Install the corresponding version of the extension

yum  -y install php72w-bcmath

Note: 72W represents version 7.2. Please specify the version number when installing
3. After the installation is complete, restart PHP

service php-fpm restart  或  systemctl restart php-fpm

4. Check to see if the PHP extension was installed successfully

php -m

Read More: