我正在尝试在Drupal 8中安装Commerce模块但是我收到错误'BC math PHP extension not found'。
我已经搜索过这个问题并尝试了不同的东西,例如通过添加'bcmath.scale = 2'来编辑PHP.ini但是我仍然收到错误消息。
任何帮助都将不胜感激,谢谢。
答案 0 :(得分:4)
只需为您的php版本安装 bcmath 插件,无需(重新)构建php,如接受的答案所述
# get php version
php -v
# install bcmath based on your version lets assume php 7.1
# for ubuntu
sudo apt install php7.1-bcmath
# for centos
yum install bcmath
# restart apache
sudo systemctl restart apache2
使用composer
安装商业或商业kickstart时会出现上述问题答案 1 :(得分:0)
该错误消息很可能表明您的PHP未使用bcmath
支持构建。 --enable-bcmath
扩展名通常不作为插件扩展名提供,但在使用bcmath
选项编译时会内置到PHP中。 Here是指向安装phpinfo();
的相关文档的链接(基本上说,您必须在编译时对其进行配置)。
要检查您的PHP,请在测试页中运行bcmath
并搜索$ php -i | grep -i bcmath
。您也可以使用CLI(如果您的Web服务器和CLI来自同一版本)使用
BCMath support => enabled
您应该看到类似于bcmath
的输出行,或者如果从您的Web服务器的PHP中查看HTML结果,则表示bcmath
已启用。
不幸的是,似乎安装public class Customer
{
/// <summary>
/// Name of customer
/// </summary>
public string Name { get; set; }
/// <summary>
/// Sex of customer
/// </summary>
public bool Sex { get; set; }
/// <summary>
/// List of favourite foods
/// </summary>
public List<string> FavouriteFoods { get; set; }
}
的唯一方法是重建PHP以获得该支持或安装预先构建的版本。我不熟悉你的设置,所以我不能再推测了。
答案 2 :(得分:0)
为 PHP 7.2 添加 BC MATH 扩展
如果您收到此 (https://prnt.sc/sehmd5) 错误,请使用 vagrant ssh 运行以下命令
在 vagrant ssh 的根目录中运行这些命令
与任何版本的 PHP 类似,您只需要在第三个命令中更改 PHP 版本即可。