PHP报错:Call to undefined function bcmul()

标签:bcmath bcmul()

PHP报错:Call to undefined function bcmul(),在网上查到

bc是Binary Calculator的缩写。bc*函数的参数都是操作数加上一个可选的 [int scale],比如string bcadd(string $left_operand, string $right_operand[, int $scale]),如果scale没有提供,就用bcscale的缺省值。这里大数直接用一个由0-9组成的string表示,计算结果返回的也是一个 string。

bcmul()需要用到bcscale函数,需要用到php-bcmath扩展

一般情况下这个扩展在php安装的时候,是存在ext/bcmath目录的

那么利用phpize进行安装新的php扩展

cd bcmath目录下

/etc/php/bin/phpize(phpize的路径根据各自安装有所不同)

./configure --with-php-config=/www/wdlinux/php/bin/php-config(php-config文件的路径)

make

make install

最后还需要把生成的bcmath.so文件加入到php.ini中 extesion=bcmath.so(如果没有设定extesion_dir,可能要加上全路径,查看phpize执行后的生成的so文件的路径即可,这里是:extension_dir=/www/wdlinux/php/lib/php/extensions/no-debug-zts-20060613)

然后重启web服务器,就Ok了

可能在make的时候,会遇到错误

错误:‘PHP_FE_END’未声明(不在函数内) -----{error: ‘PHP_FE_END’ undeclared here (not in a function)}

解决方法: 源代码有错误,进入php-5.3.18/ext/mcrypt目录

sed -i ‘s|PHP_FE_END|{NULL,NULL,NULL}|‘ ./*.c

sed -i ‘s|ZEND_MOD_END|{NULL,NULL,NULL}|‘ ./*.c

再重新make && make install

在我的实际操作中,写入php.ini的是extension= bcmath.so,重启服务后站点即可正常显示,说明extension——dir已设定。关于这一点如何设置后期可以继续学习。

PHP报错:Call to undefined function bcmul()即php-bcmath模块未正常工作

标签:bcmath bcmul()

原文:http://lyz123.blog.51cto.com/2501059/1571331

猜你喜欢

转载自blog.csdn.net/qq_26987043/article/details/80103078