5

安装 joomla 组件之一时出现以下错误。

功能:bcmod 不可用。请询问您的主机如何在您的 PHP 安装中启用此功能。

4

4 回答 4

12

您需要使用 bcmath 支持(--enable-bcmath 配置选项)编译您的 PHP。如果您在共享主机上,他们不太可能为您启用它。因此,您可以从此页面尝试 PHP 手册中的解决方案:http ://ru.php.net/manual/en/function.bcmod.php我没有尝试过,但您可以对其进行测试:

/** 
 * my_bcmod - get modulus (substitute for bcmod) 
 * string my_bcmod ( string left_operand, int modulus ) 
 * left_operand can be really big, but be carefull with modulus :( 
 * by Andrius Baranauskas and Laurynas Butkus :) Vilnius, Lithuania 
 **/ 
function my_bcmod( $x, $y ) 
{ 
    // how many numbers to take at once? carefull not to exceed (int) 
    $take = 5;     
    $mod = ''; 

    do 
    { 
        $a = (int)$mod.substr( $x, 0, $take ); 
        $x = substr( $x, $take ); 
        $mod = $a % $y;    
    } 
    while ( strlen($x) ); 

    return (int)$mod; 
} 

// example 
echo my_bcmod( "7044060001970316212900", 150 ); 
于 2012-05-16T20:58:14.337 回答
1

如果您有专用服务器,请尝试此处给出的解决方案https://stackoverflow.com/a/25229386/8015825

在重新编译之前,检查 php.ini 文件并搜索“bcmath”。您可能会发现 bcmath.scale=0。如果是这样,请将 0 更改为 2。

然后重启你的http服务器

于 2018-11-28T14:01:32.717 回答
1

您可以使用安装程序安装 bcmath 包。我使用的是 CentOS,所以我的命令相对不同。您可以根据您的操作系统使用。

yum install php-bcmath

安装软件包后,

如果您使用的是 php-fpm,那么您需要使用以下命令重新启动 php-fpm 服务

systemctl restart php-fpm

最后需要重启http服务器

systemctl restart nginx
于 2020-12-29T06:36:25.900 回答
0

需要在 Debian 10 上安装库,还要在安装 bcmath 之前删除存储库的过期密钥

apt-key list 2>/dev/null | grep expired -B 1
apt-key del 95BD4743
apt-key list | grep expired
wget -O /etc/apt/trusted.gpg.d/deb.sury.gpg https://packages.sury.org/php/apt.gpg
apt-get update
apt install php7.2-bcmath
systemctl restart apache2
于 2021-03-22T08:47:45.353 回答