Docker: 您的系统缺少所需的PHP扩展bcmath

9
我在安装bcmath时遇到以下错误。
root@cfe90ea33de0:/var/www/web# apt install php-bcmath
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php-bcmath is a virtual package provided by:
  php7.3-bcmath 7.3.14-1~deb10u1 [Not candidate version]
  php7.3-bcmath 7.3.11-1~deb10u1 [Not candidate version]
  php7.0-bcmath 7.0.33-0+deb9u7 [Not candidate version]
  php7.0-bcmath 7.0.33-0+deb9u6 [Not candidate version]

E: Package 'php-bcmath' has no installation candidate

我尝试使用以下命令,但仍然出现相同的错误。
apt-get install php7.3-bcmath
apt-get install php7.0-bcmath
V=`php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\).*$/\1/'` \apt-get install php$V-bcmath
2个回答

29
docker-php-ext-install bcmath

在登录Docker后,以上命令有效。


6
RUN docker-php-ext-install bcmath

在您的Docker文件中添加此内容并重新构建Docker镜像。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接