27

I'm using an Ubuntu 16 server for testing with php7.1. One of my app uses bcadd function. I know that I need to install bcmath module for that but I'm unable to find php7.1-bcmath. When I tried to install apt install php-bcmath, it simply installed php7.0-bcmath module.

I was unable to find php7.1-bcmath module anywhere to install on my server. Does anybody has an idea?

apt install php7.1-bcmath returned following,

E: Unable to locate package php7.1-bcmath

E: Couldn't find any package by glob 'php7.1-bcmath'

E: Couldn't find any package by regex 'php7.1-bcmath'
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Vajira Lasantha
  • 2,435
  • 3
  • 23
  • 39

4 Answers4

60

Answering my own question. Managed to fix this issue with following repo update.

add-apt-repository ppa:ondrej/php
apt update
apt install php7.1-bcmath

Restart apache and all good to go.

Vajira Lasantha
  • 2,435
  • 3
  • 23
  • 39
14

install this : https://packages.ubuntu.com/fr/artful/amd64/php7.1-bcmath/download

add this :

deb http://security.ubuntu.com/ubuntu artful-security main universe

to /etc/apt/sources.list

$ sudo apt update

$ sudo apt install php7.1-bcmath
Anass Ez-zouaine
  • 411
  • 1
  • 6
  • 12
13

Those who are looking for Ubuntu 20.04:

sudo apt install php-bcmath

It will automatically install the bcmath compatible with your version of PHP.

In order to install the specific version of bcmath for php, you can use following command:

sudo apt install php7.x-bcmath
Anish Sapkota
  • 774
  • 9
  • 19
1

For Ubuntu 16.04: Add this ppa http://ppa.launchpad.net/jczaplicki/xenial-php74-temp/ubuntu Open synaptic, and then uninstall any bcmath module already installed. Then reinstall php7.4 and php7.4-xxx modules

TomoMiha
  • 1,218
  • 1
  • 14
  • 12