【发布时间】:2011-03-24 22:37:34
【问题描述】:
如何在服务器上安装 bcmath 模块?我试过了
yum update php-bcmath
但它说什么也没找到。
【问题讨论】:
-
github.com/phpseclib/bcmath_compat 可能是一个值得考虑的选项。
如何在服务器上安装 bcmath 模块?我试过了
yum update php-bcmath
但它说什么也没找到。
【问题讨论】:
试试yum install php-bcmath。
如果还是找不到,可以试试yum search bcmath找包名
【讨论】:
yum install php53u-bcmath。
sudo apt install php7.0-bcmath
ubuntu 和 php7.1
sudo apt install php7.1-bcmath
ubuntu 和 php 没有版本说明
sudo apt install php-bcmath
【讨论】:
service apache2 reload。否则 bcmath 将不会被启用。
php71-bcmath.x86_64。使用yum search bcmath 查看您的服务器上有哪些可用选项。
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
考虑到 yum 安装在 phpinfo() 中给了我 bcmath,我不知道为什么我必须如此深入
【讨论】:
在 CentOS 6.5 上运行良好
我对 bcmath 函数的所有调用都在 apache 重启后立即开始工作
甜!
【讨论】:
使用Docker官方PHP镜像时,使用docker-php-ext-install bcmath。
来源:https://hub.docker.com/_/php?tab=description#php-core-extensions
【讨论】:
正在调用未定义的函数bcmod()
yum install php-bcmath
systemctl restart httpd.service
您应该会在 phpinfo 下看到类似于 /etc/php.d/bcmath.ini 的内容。
Centos 7
Plesk 12
PHP 5.4.16
【讨论】:
如果你安装了php 7.1
那么这条线在你的系统上工作。
sudo apt install php7.1-bcmath
在ubuntu 16.04上检查您系统中的php版本
php -v
然后结果显示在那里..
PHP 7.1.x+ubuntu16.04.1+deb.sury.org+1 (cli)(构建时间:2018 年 8 月 19 日 07:16:12) (NTS) 版权所有 (c) 1997-2018 The PHP Group Zend Engine v3.2.0,版权所有 (c) 1998-2018 Zend Technologies 使用 Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1,版权所有 (c) 1999-2018,由 Zend Technologies 提供
【讨论】:
使用 remi 存储库的 PHP 7.1 在 Centos 7.4 上对我有用。
首先找出我拥有的 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
然后在remi-php71存储库中搜索bcmath扩展:
[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
现在安装第一个匹配的扩展:
[kiat@reporting ~]$ sudo yum --enablerepo=remi-php71 install php-bcmath
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
.
.
.
最后重启php和nginx:
[kiat@reporting ~]$ sudo systemctl restart php-fpm nginx
【讨论】:
我发现包含该软件包的 repo 未启用。在 OEL7 上,
$ vi /etc/yum.repos.d/ULN-Base.repo
Set enabled to 1 for ol7_optional_latest
$ yum install php-bcmath
而且效果很好……
我使用以下命令查找包所在的位置
$ yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo C5.\*,c5-media,\*debug\*,\*-source list \*bcmath
【讨论】:
如果要启用任何扩展,则必须先安装扩展,扩展可能已启用但未安装,因此以bcmath为例
yum 搜索 php-bcmath
然后确保您要安装此扩展的 php 版本
你会得到类似 yum search 命令之后的输出>>
yum 搜索 php-bcmath** 加载的插件:fastestmirror、universal-hooks 从缓存的主机文件加载镜像速度
EA4: 66.71.244.18
cpanel-addons-production-feed: 66.71.244.18
base: mirror.nodesdirect.com
epel: mirror.coastal.edu
extras: www.gtlib.gatech.edu
nux-dextop: mirror.li.nux.ro
updates: mirror.jaleco.com
**============================================================== N/S matched: php-bcmath ===============================================================
ea-php54-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php55-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php56-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php70-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php72-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
如果我想为 php71 安装,那么命令将类似于 yum install ea-php71-php-bcmath.x86_64 或 yum install php71-bcmath。
您可以安装上述步骤中的任何扩展。
【讨论】:
在 Ubuntu PHP 7.3 中
sudo apt install php7.3-bcmath
【讨论】:
在Arch Linux 或Manjaro 中启用bcmath
编辑php.ini
nano /etc/php/php.ini
取消注释bcmath(删除分号)
extension=bcmath
如果您使用的是 Apache 服务器,请通过以下方式重新加载服务器
sudo systemctl reload apache.server
或者
sudo systemctl realod httpd
如果你不使用 Apache
sudo systemctl reload php-fpm.service
查看激活的模块
php -m
要确保 bcmath 已安装并激活,请搜索它
php -m | grep bcmath
【讨论】:
这对我有用install php72-php-bcmath.x86_64
那么,
systemctl restart php72-php-fpm.service
【讨论】:
对于 PHP 7+ 版本,您只能使用:
sudo apt install php-bcmath
【讨论】:
我刚刚尝试了下面的 php v5.6 包,它对我有用。
yum install php56w-bcmath
【讨论】:
apt repo 有这个扩展,只需从终端运行以下命令::
sudo apt-get install php7.2-bcmath*
【讨论】:
如果仍然有人不知道如何安装 bcmath,因为它还有许多其他依赖模块要安装,例如 php7.2-common 等。
尝试使用突触应用程序,安装相同的。开火命令。\
sudo apt-get install synaptic
打开突触应用程序,然后单击搜索选项卡。
搜索bcmath
搜索结果会显示所有依赖于php的包。
根据您的方便安装。
并使用安装所需的所有自动填充依赖项进行安装。
就是这样。
【讨论】:
对于带有 php7.0 的 Centos 7
安装 CentOS SCLo RH 仓库:yum install centos-release-scl-rh
安装rh-php71-php-bcmath rpm包:yum install rh-php71-php-bcmath
systemctl restart httpd.service
【讨论】:
如果你想在 ubuntu 中安装 PHP 扩展。
首先知道哪个 PHP 版本处于活动状态。
php -v
之后使用此命令安装所需的插件。
sudo apt install php7.0-bcmath
你可以把php7.0-bcmath替换成php-PHPVersion-extensionName
【讨论】: