Hi,

using a clean installetion of the 6.x-2.2 on a drupal multisite currently running 6.20. After I have inserted the location and browse to the list of the forecast's i get the message

"Fatal error: Call to undefined function bcmul() in /var/www/html/modules/yr_verdata/yr_verdata.module on line 721"

I cant seem to figure this one out. Any ideas ?

CommentFileSizeAuthor
#3 bcmath.zip614 bytesreswild

Comments

tjodolv’s picture

bcmul() is a function in php. This error means that the php version on your server has not been compiled with the necessary library, called BC Math (http://php.net/manual/en/book.bc.php). You need to talk to your server admin about this.

tjodolv’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Closing this as this is an issue with the server PHP installation, not this module or Drupal.

reswild’s picture

Status: Closed (works as designed) » Active
StatusFileSize
new614 bytes

If your sever isn't compiled with bcmath, you can add the following replacement functions to your code:

if (!function_exists(bcmul)) {
  function bcmul($_ro, $_lo, $_scale=0) {
    return round($_ro*$_lo, $_scale);
  }
}
  
if (!function_exists(bcdiv)) {
  function bcdiv($_ro, $_lo, $_scale=0) {
    return round($_ro/$_lo, $_scale);
  }
}

...or just activate the enclosed module if you don't know where to add the above code.

ElvinJones’s picture

Worked like a charm! Got it also working when i added bcmath to my webserver as you suggested earlier.

Thanks alot!

tjodolv’s picture

Thanks for the code, reswild. I assume I can include this in future versions of the Yr module?

reswild’s picture

You can of course use it if you like. I just copied it from a user comment in the php user manual.

tjodolv’s picture

Status: Active » Fixed

Great, thank you for the contribution :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

waverate’s picture

For RHEL, I added the php-bcmath rpm

yum install php-bcmath
hansfn’s picture

I'm sorry to comment on a fixed issue, but is it really necessary that this module "requires" the bcmath PHP extension? Couldn't the module just include the code/patch from reswild in comment 3? Those 7 extra lines would have saved me some time today ;-)

tjodolv’s picture

Yes, I will incorporate this in the next release of the module. I haven't had the time to work on it the last few months because of school, but I have some more time on my hands the next months :)