How to install bcmath module?
Asked Answered
H

19

71

How do I install the bcmath module on a server? I tried

yum update php-bcmath

but it said it found nothing.

Hive answered 3/8, 2010 at 20:5 Comment(1)
github.com/phpseclib/bcmath_compat might be an option worth considering.Felsite
L
70

Try yum install php-bcmath. If you still can't find anything, try yum search bcmath to find the package name

Landy answered 3/8, 2010 at 20:35 Comment(6)
hi, i tried this along with the update but it did not work. but I did some search in google and found that centos doesnt have bcmath for the version of php i have on my server. so i think i am planning to find some other alternative.s thanksHive
Ok I supposed you had fedora... It would have been useful to specify your distribution in your question.Landy
CentOS Linux release 6.0 (Final) has php-bcmathLibretto
I had to go with yum install php53u-bcmath due to some conflicts.Hajj
In php7, sudo apt install php7.0-bcmathExpedite
This worked for me. Yum automatically detected the correct package for the php version I was usingKatzman
K
68

ubuntu and php7.1

sudo apt install php7.1-bcmath

ubuntu and php without version specification

sudo apt install php-bcmath
Katushka answered 10/7, 2017 at 20:11 Comment(4)
sudo apt-get install php7.0-bcmathVirginia
how do you install it in mac?Kyongkyoto
And (if using apache), service apache2 reload afterwards. Otherwise bcmath won't yet be enabled.Affenpinscher
I've hit a few servers where yum needs the CPU arch at the end of the package name, i.e. php71-bcmath.x86_64. Use yum search bcmath to see what options are available on your server.Integrity
S
12
yum install php72-php-bcmath.x86_64
cp /etc/opt/remi/php72/php.d/20-bcmath.ini /etc/php.d/
cp /opt/remi/php72/root/usr/lib64/php/modules/bcmath.so /usr/lib64/php/modules/
systemctl restart httpd

Not sure why I had to go so deep considering the yum install gave me bcmath in phpinfo()

Say answered 23/7, 2018 at 2:34 Comment(2)
Because you need php-bcmath (base package, from remi-php72) not php72-php-bcmath (SCL from remi-safe)Blindworm
This solution worked for me. I am new to this. Can somebody explain this in details? Or provide a link where I can see more details.Giorgi
P
11

Worked great on CentOS 6.5

yum install bcmath

All my calls to bcmath functions started working right after an apache restart

service httpd restart

Sweet!

Poulin answered 31/1, 2014 at 20:17 Comment(0)
G
8

When using the official PHP images of Docker, use docker-php-ext-install bcmath.

Source: https://hub.docker.com/_/php?tab=description#php-core-extensions

Gyrostabilizer answered 28/8, 2019 at 13:39 Comment(1)
Thank you SO much! It's been 5+ years since I've done any php, but I have since started using Docker for everything. I had to dig up a really old project and I've been adding random PPA's and debs, trying to use PECL and a bunch of other things for hours. Composer install finally worked thanks to you!Overmatch
C
6

Was getting call to undefined function bcmod()

yum install php-bcmath
systemctl restart httpd.service

you should then see something similar to /etc/php.d/bcmath.ini listed under phpinfo.

Centos 7
Plesk 12
PHP 5.4.16
Carruth answered 24/2, 2015 at 18:23 Comment(0)
K
4

If you have installed php 7.1 then this line work on your system.

sudo apt install php7.1-bcmath

check your php version in your system on ubuntu 16.04

php -v

and then result show there..

PHP 7.1.x+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Keeleykeelhaul answered 24/9, 2018 at 11:47 Comment(0)
L
4

The following worked for me on Centos 7.4 with PHP 7.1 using remi repository.

First find out which PHP version I have:

[kiat@reporting ~]$ php --version
PHP 7.1.33 (cli) (built: Oct 23 2019 07:28:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

Then search for bcmath extension in remi-php71 repository:

[kiat@reporting ~]$ yum search php71 | grep bcmath
php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php71u-bcmath.x86_64 : A module for PHP applications for using the bcmath

Now install the first matching extension:

[kiat@reporting ~]$ sudo yum --enablerepo=remi-php71 install php-bcmath
Loaded plugins: fastestmirror, langpacks
base                                                     | 3.6 kB     00:00
.
.
.

Finally, restart php and nginx:

[kiat@reporting ~]$ sudo systemctl restart php-fpm nginx
Lynlyncean answered 17/12, 2019 at 2:0 Comment(0)
H
3

I found that the repo that had the package was not enabled. On OEL7,

$ vi /etc/yum.repos.d/ULN-Base.repo
Set enabled to 1 for ol7_optional_latest

$ yum install php-bcmath

and that worked...

I used the following command to find where the package was

$ yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo C5.\*,c5-media,\*debug\*,\*-source list \*bcmath
Hiragana answered 5/6, 2016 at 21:39 Comment(1)
Worked on Debian.Paraclete
P
3

If you want to enable any extension then you have to install an extension first, extension maybe enabled but not installed, so taking the example of bcmath

  1. yum search php-bcmath

  2. Then ensure the php version in which u want to install this extension

  3. You will get output like after yum search command>>

yum search php-bcmath** Loaded plugins: fastestmirror, universal-hooks Loading mirror speeds from cached hostfile

EA4: 66.71.244.18
cpanel-addons-production-feed: 66.71.244.18
base: mirror.nodesdirect.com
epel: mirror.coastal.edu
extras: www.gtlib.gatech.edu
nux-dextop: mirror.li.nux.ro
updates: mirror.jaleco.com
**============================================================== N/S matched: php-bcmath ===============================================================
ea-php54-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php55-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php56-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php70-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php72-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
  1. If I wanna install for php71 then the command will be like yum install ea-php71-php-bcmath.x86_64 or yum install php71-bcmath.

  2. You can install any extension from the above steps.

Philis answered 29/11, 2018 at 10:13 Comment(0)
H
2

In Ubuntu PHP 7.3

sudo apt install php7.3-bcmath
Hialeah answered 27/11, 2019 at 22:35 Comment(0)
I
2

To enable bcmath in Arch Linux or Manjaro

Edit php.ini

nano /etc/php/php.ini

Uncomment bcmath (remove semicolon)

extension=bcmath

If you are using Apache server reload the server by

sudo systemctl reload apache.server

Or

sudo systemctl realod httpd

If you don't use Apache

sudo systemctl reload php-fpm.service

To see the activated modules

php -m

To make sure the bcmath is installed and activated, search for it

php -m | grep bcmath
Irrationality answered 13/1, 2021 at 13:44 Comment(0)
Z
1

This worked for me install php72-php-bcmath.x86_64 Then,

systemctl restart php72-php-fpm.service
Zoonosis answered 12/7, 2019 at 12:38 Comment(0)
D
1

For PHP 7+ version you can use only:

sudo apt install php-bcmath
Decolorant answered 28/9, 2019 at 8:55 Comment(0)
A
0

I just tried below package for php v5.6 and it worked for me.

yum install php56w-bcmath
Abyssal answered 7/2, 2018 at 3:42 Comment(0)
E
0

apt repo have this extension, just run the below command from your terminal ::

sudo apt-get install php7.2-bcmath*

Ephod answered 17/1, 2019 at 8:23 Comment(0)
P
0

If still anyone is not getting how to install bcmath as it has lots of other dependant modules to install like php7.2-common, etc.

Try using synaptic application, to install the same. fire command.\

sudo apt-get install synaptic

Open the synaptic application and then click on search tab.

search for bcmath

search results will show all the packages depends on php.

Install as per your convenience.

and install with all auto populated dependancies it required to install.

That's it.

Paraselene answered 12/2, 2019 at 10:39 Comment(0)
F
0

For Centos 7 with php7.0

Install CentOS SCLo RH repository: yum install centos-release-scl-rh

Install rh-php71-php-bcmath rpm package: yum install rh-php71-php-bcmath

systemctl restart httpd.service

Flowage answered 13/8, 2019 at 17:1 Comment(0)
L
0

If you want to install PHP extensions in ubuntu.

first know which PHP version is active.

php -v

After that install needed plugin using this command.

sudo apt install php7.0-bcmath

you can replace php7.0-bcmath to php-PHPVersion-extensionName

Late answered 3/9, 2019 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.