Enable BCMath using php.ini?
Asked Answered
B

2

10

I need to enable BC Math, but I don't want to do it using --enable-bcmath, primarily because I don't understand that route.

Is there a way to do this using php.ini only?

Brahe answered 25/4, 2013 at 14:44 Comment(2)
To the best of my knowledge you must compile php with the --enable-bcmath option. Without it, the required code won't exist in the binary. Therefore, there is nothing that you can set in php.ini.Annadiana
I can't accept your answer, as it's only a comment. If you want to put it as an answer I'll accept it.Brahe
A
13

To the best of my knowledge you must compile php with the --enable-bcmath option. Without it, the required code won't exist in the binary. Therefore, there is nothing that you can set in php.ini

Annadiana answered 2/5, 2013 at 14:38 Comment(6)
or apt-get install php5-bcmathNye
I'm getting Unable to locate package php5-bcmath. Does it have a different name now?Trite
@Nye In Ubuntu (and it's save to assume in Debian as well), bcmath is included as part of the php5 source package and all php5 binary packages in Ubuntu and Debian (since php 5.3.10 at least) have bcmath included by default, so you do not need to install any additional packages to get it. I can show evidence (for Ubuntu at least) that supports this statement.Tabes
Just go for "php-bcmath", it'll install the most recent package (today it'd be php7-bcmath)Alopecia
@Alopecia is right that php-bcmath installs latest - but be aware - you only want that if you also want to have latest php - if your project runs e.g. on php 5.4 , install php5 packages ;) Sidenote: on Ubuntu 18.04 I had to install this package manually (for php 7.2.1)Sweeny
for me sudo apt install php7.X-bcmath resolved a problemEctoparasite
L
8

Before recompiling, check the php.ini file and search for "bcmath". You may find bcmath.scale=0. If so, change the 0 to a 2.

Loser answered 10/8, 2014 at 14:5 Comment(2)
"Number of decimal digits for all bcmath functions.", its not about enabling the extensionComity
And restart your httpd server.Breakneck

© 2022 - 2024 — McMap. All rights reserved.