gotomypc / mysql-log-filter

Automatically exported from code.google.com/p/mysql-log-filter
1 stars 0 forks source link

PHP Fatal error: Call to undefined function bcadd() #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. php mysql_filter_slow_log.php -T=3 -eu=root --no-duplicates 
--sort-execution-count --top=10 --incremental mysql-slow.log  > 
mysql-slow-queries.log
2. it will show you the error. 
3. execute it.  

What is the expected output? What do you see instead?
i should get ouptut in sql file

What version of the product are you using? On what operating system?
1.9

Please provide any additional information below.
PHP Warning:  mktime(): It is not safe to rely on the system's timezone 
settings. You are *required* to use the date.timezone setting or the 
date_default_timezone_set() function. In case you used any of those methods and 
you are still getting this warning, you most likely misspelled the timezone 
identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in 
/root/mysql_filter_slow_log.php on line 169
PHP Warning:  mktime(): It is not safe to rely on the system's timezone 
settings. You are *required* to use the date.timezone setting or the 
date_default_timezone_set() function. In case you used any of those methods and 
you are still getting this warning, you most likely misspelled the timezone 
identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in 
/root/mysql_filter_slow_log.php on line 169
PHP Fatal error:  Call to undefined function bcadd() in 
/root/mysql_filter_slow_log.php on line 528

Original issue reported on code.google.com by helloam...@gmail.com on 16 Aug 2012 at 9:40

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for your report.
What platform are you using (Linux 32-bit)?

PHP 32-bit limits integers to 2 << 30: a 
http://php.net/manual/en/language.types.integer.php
Therefore I used the bcmath extension to allow big numbers even on 32-bit 
platforms: http://php.net/manual/en/book.bc.php

Please execute and post:
php -r "printf(\"PHP_INT_MAX=%d. bcmath extension %sloaded. PHP %s on %s\n\", 
PHP_INT_MAX, extension_loaded('bcmath') ? '':'NOT ', phpversion(), 
php_uname());"

If the number is big enough for your data, you may replace line 150:
  return 10 == $i || 13 == $i ? $b[$i] - $[$i] : ($a[$i] < $b[$i] ? 1 : -1);
and lines 528 and 529:
  $sum_rows_sent += $query_time[2];
  $sum_rows_examined += $query_time[3];
and lines 543 and 544:
  $avg_rows_sent = round($sum_rows_sent / $execution_count, 1);
  $avg_rows_examined = round($sum_rows_examined / $execution_count, 1);

Original comment by rene.leonhardt@gmail.com on 17 Aug 2012 at 11:48

rodrigoguariento commented 4 years ago

Eg.: using Ubuntu 18.04LTS with nginx + PHP 7.2 try:

$ sudo apt install php7.2-bcmath
$ sudo systemctl reload nginx php7.2-fpm