Im running nginx/php-fpm server in a docker container and I added an extension with

> docker-php-ext-install bcmath

bcmath functions are available on command line but not in script

i.e. this works:

> bash-4.4# php -r "echo bcdiv('105', '6.55957', 3);"

but this fails

// test.php
echo bcdiv('105', '6.55957', 3);  // 16.007

when delivered as


the result (in the browser) =

Fatal error: Uncaught Error: Call to undefined function bcdiv() in /var/www/html/web/test.php:3 Stack trace: #0 {main} thrown in /var/www/html/web/test.php on line 3

Why can the command line see the extension, but the script can't? Any help much appreciated. Thanks.

1 Answers

Laurence Fass On

Solution: Restarting nginx (in my case) was not sufficient. I had to restart php-fpm for changes to take effect. Result: works ok.