Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make App Engine for PHP load BCMath or php.ini

I'm running the latest php-cgi from Arch Linux's repos. I enabled the BCMath module on php.ini and it works when I run php, php-cgi and php in Apache. However, when dev_appserver.py runs php, somehow it loses the configuration I set in php.ini. Causing both BCMath, soap and my locale settings to not load, causing:

dev_appserver.py --php_executable_path /usr/bin/php-cgi appengine-try-php
PHPEnvironmentError: The PHP runtime requires the "bccomp" function, which is not defined.

php-cgi -i | grep -i bcmath returns BCMATH enabled.

php -i | grep -i bcmath returns BCMATH enabled.

php -r "echo bccomp('1.0001', '1', 5);" returns 1.

Is there any way to make dev_appserver.py load the module or php.ini?

like image 521
Ray Foss Avatar asked Dec 31 '25 06:12

Ray Foss


1 Answers

Here's the code that fails - we check if the function exists.

if (!function_exists('bccomp')) {
  echo "The PHP runtime requires the \"bccomp\" function, which is not ";
  echo "defined.\n";
  echo "If you built PHP using \"configure\" then please rebuild with:\n";
  echo ' ./configure  --enable-bcmath';
  exit(1);
}

I don't know why you'd have the extension enabled but the function not existing. Probably try listing the functions that are available to double check it's there.

 php -r 'print_r(get_defined_functions());' | grep -i bccomp
like image 73
Stuart Langley Avatar answered Jan 02 '26 20:01

Stuart Langley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!