The PHP function bcdiv is not available by default. How do I enable that in PHP configuration?
Asked
Active
Viewed 4.5k times
13
muru
- 193,181
- 53
- 473
- 722
Jiří Doubravský
- 1,877
- 5
- 23
- 34
3 Answers
21
Install module bcmath
sudo apt-get install php-bcmath
(note: on ubuntu 16.04^ with PHP 7.0^ use php7.0-bcmath package instead)
Restart apache service eventually
sudo service apache2 restart
Jiří Doubravský
- 1,877
- 5
- 23
- 34
-
The answer should note that this wont work on php 7.0. At least on my machine it didnt work. Next asnwer - worked. – Denis Matafonov Feb 07 '18 at 22:34
11
Install module bcmath in PHP 7.0, you should try:
sudo apt-get install php7.0-bcmath
And restart php engine or apache
Kenny
- 111
- 1
- 2
-
2This answer should note that [`php7.0-bcmath` is available in 16.04 and newer releases](http://packages.ubuntu.com/search?keywords=php7.0-bcmath&searchon=names&suite=all§ion=all) only. – Apr 03 '17 at 03:26
2
If you're using Docker, then you can install it using docker-php-ext-install:
# Dockerfile
FROM php:7.4-fpm-alpine
RUN docker-php-ext-install bcmath
Scofield
- 121
- 4