PHP offers various extensions to deal with different cases. BCMath is one of the PHP extensions which is an interface to the GNU implementation as a library of the Basic Calculator that deals with float values in PHP. This extension helps in implementing the function related to mathematics on the production server without any arbitrary precision errors. It allows calculations on numbers (represented in string format) of any size and precision.
Downloading and Installation of Php BCMath
We can use the “yum” package manager to install the “php bcmath” extension on CentOS7.
Follow the further steps to install php bcmath extension on CentOS
Step 1: First, use the yum package manager to update the existing packages to their latest version. Type the command below to update the packages.
sudo yum update -y
The command using yum package manager will give the output of the running update.
Step 2: Now we directly install the PHP’s BCMath extension by typing the command below in the terminal.
sudo yum install php-bcmath
Once it executes we will get an output which is shown below
Output 1
Output 2
The above two screenshot shows the output of running the install bcmath command it will directly install the extension according to the version of the PHP installed in your system. Here in this case we have PHP 5.4.16 installed in our system. We can check the PHP version installed in our system by typing the commands below.
php –version
This command will display the output of the command to check PHP version.
Step 3: Once the installation is completed, type the command below to check the status of “apache/httpd” service.
service httpd status
The status of the apache server whether it is active or inactive.
Step 4: If the apache service is inactive, restart it by typing the command below.
service httpd restart
The command for starting the apache server is successfully running.