PHP | “The requested PHP extension bcmath is missing from your system.”

You can use function get_loaded_extensions to see if bcmath modul is loaded. Or in terminal php -m or php -m | grep name_of_the_modul

You can install it depending on what OS you are using:

Ubuntu

sudo apt install php7.0-bcmath

CentOS

yum install bcmath

PHP 7.2

Debian - jessie

apt-get update

apt-get install php7.2-bcmath

work like a charm :)

For PHP 7.1, the following worked for me:

sudo apt install php7.1-bcmath

For any version in php Centos use

This solution worked for me

yum install php-bcmath

PHP will take the default version installed in the machine, search for that package and install it.

Delete the file composer.lock file if that is already created and then run again,

composer install

If you run

composer update

it will update whatever default packages are installed in composer.json which might create problem for you.

check your php version by type: php --version

you will see something like this:

PHP 7.2.9-1+ubuntu16.04.1 ....

then sudo apt install phpX.X-bcmath where X.X is php version, so for this ^ example it will be sudo apt install php7.2-bcmath

after this check if module existed or not by type php -m | grep bcmath

php 7.2 if you have other version just change it accordingly

For CentOS

sudo yum install php72-bcmath

For Ubuntu

sudo apt install php7.0-bcmath

hope this will fix the problem.

sudo apt install php-bcmath

Strange thing here
Some month ago I have installed all PHP version in the same manner. In here are the 4 identically configured version of php: 5.6, 7.0, 7.1, 7.2, with the same extensions ( when this was made possible ).
The strange thing was that bcmath is present for all php version excluding 7.1.
In the solution search I arrive here in this question, where the logic's things was confirmed installing bcmath, but in my Linode Debian 9 server the command apt install php7.1-bcmath doesn't work, with 3 error messages;

  • E: Impossible to find the package php7.1-bcmath
  • E: Impossible to find some package with glob "php7.1-bcmath"
  • E: Impossible to find a package with the regular expression "php7.1-bcmath"

The goals no meet with any combination of tips and trick, refreshing apt cache, change Debian's mirrored server, installing yum, so on...

After some tentatives I had an illumination: modificating of /etc/apt/sources.list enabling the default Linode repository, then after an apt update (with no solution in the immediate), I have restored the /etc/apt/sources.list commenting out the Linode mirror sources again. Magically, after the new apt update the command now are working.

By this I confirm: apt install php7.1-bcmath is the right command, but your Debian can need a kick in the ass

For this problem we should use sudo apt install php-bcmath

I tried below package and it worked in Php version 5.6

yum install php56w-bcmath