如何在服务器上安装bcmath模块?我尝试了
yum update php-bcmath
但它说它什么也没找到。
尝试使用yum install php-bcmath
命令安装。如果还找不到,可以使用yum search bcmath
查找软件包名称。
yum install php53u-bcmath
。 - Kenny Wylandsudo apt install php7.0-bcmath
命令安装bcmath扩展。 - insignUbuntu和PHP7.1
sudo apt install php7.1-bcmath
没有版本规范的Ubuntu和PHP
sudo apt install php-bcmath
php71-bcmath.x86_64
。使用yum search bcmath
查看您的服务器上有哪些选项可用。 - thirdenderyum 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 install 已经在 phpinfo() 中给了我 bcmath 模块。
在CentOS 6.5上表现良好
在apache重启后,我所有对bcmath函数的调用都开始正常工作了
太棒了!
docker-php-ext-install bcmath
。报错信息为“调用未定义的函数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) (built: Aug 19 2018 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提供
[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
我发现包含该软件包的仓库未启用。在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
yum search php-bcmath
然后确保您要安装此扩展的php版本
您将得到类似于yum search命令之后的输出>>
yum search 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。
您可以从以上步骤安装任何扩展。