2

I am getting this error

PHP Fatal error: Call to undefined function bccomp()

I am using Ubuntu, and I installed PHP-5.6 using APT-GET command

yivi
  • 1
  • 16
  • 86
  • 115
justsomedev
  • 624
  • 2
  • 9
  • 20

1 Answers1

10

bccomp() function belongs to BCMath package; if it's undefined, apparently, there's something wrong with the package itself. To be more specific, it's not enabled (as since PHP 4.0.4, libbcmath is bundled with PHP).

Quoting the docs:

These functions are only available if PHP was configured with --enable-bcmath.

The Windows version of PHP has built-in support for this extension. You do not need to load any additional extensions in order to use these functions.

raina77ow
  • 99,006
  • 14
  • 190
  • 222
  • 1
    And of course, if you are on a new computer with Ubuntu. ensure you _install_ the package, e.g. `sudo apt install php-bcmath` – Robert Dundon Aug 21 '20 at 12:42
  • best is to install the bcmath extension with the php version number. `sudo apt install php7.x-bcmath`. and restart the service. `service apache2 restart` – VishalParkash Sep 25 '20 at 05:33