php 如何安装 bcmath 模块?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3400362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install bcmath module?
提问by JDesigns
How do I install the bcmath module on a server? I tried
如何在服务器上安装 bcmath 模块?我试过
yum update php-bcmath
but it said it found nothing.
但它说它什么也没找到。
回答by greg0ire
Try yum install php-bcmath
.
If you still can't find anything, try yum search bcmath
to find the package name
试试yum install php-bcmath
。如果仍然找不到任何东西,请尝试yum search bcmath
查找包名称
回答by Albert s
ubuntu and php7.1
ubuntu 和 php7.1
sudo apt install php7.1-bcmath
ubuntu and php without version specification
ubuntu 和 php 没有版本说明
sudo apt install php-bcmath
回答by Anthony
Worked great on CentOS 6.5
在 CentOS 6.5 上运行良好
yum install bcmath
yum 安装 bcmath
All my calls to bcmath functions started working right after an apache restart
我对 bcmath 函数的所有调用都在 apache 重启后立即开始工作
service httpd restart
服务 httpd 重启
Sweet!
甜的!
回答by fragbait
yum install php72-php-bcmath.x86_64
cp /etc/opt/remi/php72/php.d/20-bcmath.ini /etc/php.d/
cp /opt/remi/php72/root/usr/lib64/php/modules/bcmath.so /usr/lib64/php/modules/
systemctl restart httpd
Not sure why I had to go so deep considering the yum install gave me bcmath in phpinfo()
不知道为什么我必须深入考虑 yum 安装在 phpinfo() 中给了我 bcmath
回答by testing
If you have installed php 7.1
then this line work on your system.
如果您已经安装,php 7.1
那么这条线可以在您的系统上运行。
sudo apt install php7.1-bcmath
check your php version in your system on ubuntu 16.04
检查您系统中的 php 版本 ubuntu 16.04
php -v
and then result show there..
然后结果显示在那里..
PHP 7.1.x+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
PHP 7.1.x+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS ) 版权所有 (c) 1997-2018 The PHP Group Zend Engine v3.2.0,版权所有 (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1,版权所有 (c) 1999-2018,由 Zend Technologies
回答by marijnz0r
When using the official PHP images of Docker, use docker-php-ext-install bcmath
.
使用 Docker 官方 PHP 镜像时,使用docker-php-ext-install bcmath
.
Source: https://hub.docker.com/_/php?tab=description#php-core-extensions
来源:https: //hub.docker.com/_/php?tab=description#php-core-extensions
回答by MrT
Was getting call to undefined function bcmod()
正在调用未定义的函数 bcmod()
yum install php-bcmath
systemctl restart httpd.service
you should then see something similar to /etc/php.d/bcmath.ini
listed under phpinfo.
然后,您应该会看到类似于/etc/php.d/bcmath.ini
phpinfo 下列出的内容。
Centos 7
Plesk 12
PHP 5.4.16
回答by kiatng
The following worked for me on Centos 7.4 with PHP 7.1 using remi repository.
以下使用 remi 存储库在 Centos 7.4 和 PHP 7.1 上为我工作。
First find out which PHP version I have:
首先找出我有哪个PHP版本:
[kiat@reporting ~]$ php --version
PHP 7.1.33 (cli) (built: Oct 23 2019 07:28:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
Then search for bcmath
extension in remi-php71
repository:
然后bcmath
在remi-php71
存储库中搜索扩展名:
[kiat@reporting ~]$ yum search php71 | grep bcmath
php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php71u-bcmath.x86_64 : A module for PHP applications for using the bcmath
Now install the first matching extension:
现在安装第一个匹配的扩展:
[kiat@reporting ~]$ sudo yum --enablerepo=remi-php71 install php-bcmath
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
.
.
.
Finally, restart php and nginx:
最后,重启php和nginx:
[kiat@reporting ~]$ sudo systemctl restart php-fpm nginx
回答by fcva
In Ubuntu PHP 7.3
在 Ubuntu PHP 7.3 中
sudo apt install php7.3-bcmath
回答by Neo
I found that the repo that had the package was not enabled. On OEL7,
我发现没有启用包含该包的 repo。在 OEL7 上,
$ vi /etc/yum.repos.d/ULN-Base.repo
Set enabled to 1 for ol7_optional_latest
$ yum install php-bcmath
and that worked...
这有效......
I used the following command to find where the package was
我使用以下命令查找包的位置
$ yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo C5.\*,c5-media,\*debug\*,\*-source list \*bcmath