“系统中缺少请求的PHP扩展名BCMATH”。

发布于 2025-01-20 03:27:19 字数 3041 浏览 1 评论 0 原文

问候其他开发人员,

我正在尝试将Composer用于我最近启动的开发服务器上的PHP项目,并且由于某种原因无法做到。但是,我成功安装了作曲家,但是,当我尝试运行 require 命令时,我会收到以下错误:

root@webserver:/var/mypersonal/index# composer require php-amqplib/php-amqplib
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll' - /usr/lib/php/20151012/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.6 for php-amqplib/php-amqplib
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - php-amqplib/php-amqplib v2.6.3 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.1 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.0 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - Installation request for php-amqplib/php-amqplib ^2.6 -> satisfiable by php-amqplib/php-amqplib[v2.6.0, v2.6.1, v2.6.2, v2.6.3].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

我假设这与PHP警告有关,我在运行 Composer时正确收到需要命令,但没有Google搜索结果将我带到正确的方向。

此外,我还提供了我的 /etc/php/7.0/cli/php.ini 该文件中错误的文件。

https://gist.github.com/anonymous/bc5bac59d684cbf575cef931ef36daf6 (I由于帖子的字符限制,因此无法在本文中包含该文件。)

Greetings fellow developers,

I am trying to use composer for a PHP project of mine on a development server I recently booted up and for some reason I am unable to. I successfully installed composer, however, when I try to run the require command I get the following error:

root@webserver:/var/mypersonal/index# composer require php-amqplib/php-amqplib
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll' - /usr/lib/php/20151012/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.6 for php-amqplib/php-amqplib
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - php-amqplib/php-amqplib v2.6.3 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.1 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - php-amqplib/php-amqplib v2.6.0 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - Installation request for php-amqplib/php-amqplib ^2.6 -> satisfiable by php-amqplib/php-amqplib[v2.6.0, v2.6.1, v2.6.2, v2.6.3].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

I'm assuming it's something to do with the PHP warning I recieve right when running the composer require command but no google search results lead me to the correct direction.

Additionally, I have provided my /etc/php/7.0/cli/php.ini file incase of an error in that file.

https://gist.github.com/anonymous/bc5bac59d684cbf575cef931ef36daf6 (I couldn't include the file in this post due to the character limit on posts.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(16

猫腻 2025-01-27 03:27:19

您可以使用函数 get_loaded_extensions 查看是否 bcmath 模量已加载。或在终端 php -m php -m | grep name_of_the_modul

您可以根据所使用的操作系统进行安装:

ubuntu

sudo apt apt install php7.0 bcmath

centos> centos

yum安装bcmath bcmath

You can use function get_loaded_extensions to see if bcmath modul is loaded. Or in terminal php -m or php -m | grep name_of_the_modul

You can install it depending on what OS you are using:

Ubuntu

sudo apt install php7.0-bcmath

CentOS

yum install bcmath

静谧 2025-01-27 03:27:19

PHP 7.2

Debian - 杰西

apt-get 更新

apt-get 安装 php7.2-bcmath

像魅力一样工作:)

PHP 7.2

Debian - jessie

apt-get update

apt-get install php7.2-bcmath

work like a charm :)

小忆控 2025-01-27 03:27:19

如果您使用的是Docker:

  • bcmath 可以通过在容器中运行此命令来安装: docker-php- ext-int-install bcmath bcmath

If you are using Docker:

  • bcmath can be installed by running this command inside a container: docker-php-ext-install bcmath
缪败 2025-01-27 03:27:19

在 Ubuntu 20.04 中

对于 php 7.4.3,sudo apt install php7.4-bcmath

In Ubuntu 20.04

For php 7.4.3, sudo apt install php7.4-bcmath

↙温凉少女 2025-01-27 03:27:19

对于 php Centos 中的任何版本,使用

此解决方案对我有用

yum install php-bcmath

PHP 将采用计算机中安装的默认版本,搜索该包并安装它。

如果已经创建了文件composer.lock文件,请删除该文件,然后再次运行,

composer install

如果运行

composer update

它将更新composer.json中安装的所有默认包这可能会给你带来问题。

For any version in php Centos use

This solution worked for me

yum install php-bcmath

PHP will take the default version installed in the machine, search for that package and install it.

Delete the file composer.lock file if that is already created and then run again,

composer install

If you run

composer update

it will update whatever default packages are installed in composer.json which might create problem for you.

乞讨 2025-01-27 03:27:19

对于php 7.1,以下对我有用:

sudo apt install php7.1-bcmath

For PHP 7.1, the following worked for me:

sudo apt install php7.1-bcmath
不必了 2025-01-27 03:27:19

按类型检查您的 php 版本: php --version

您将看到类似以下内容:

PHP 7.2.9-1+ubuntu16.04.1 ....

然后 sudo apt install phpX.X-bcmath 其中 XX 是 php 版本,因此对于此 将是 sudo apt install php7.2-bcmath

^ 例如,在按类型 php -m | 检查模块是否存在后, grep bcmath

check your php version by type: php --version

you will see something like this:

PHP 7.2.9-1+ubuntu16.04.1 ....

then sudo apt install phpX.X-bcmath where X.X is php version, so for this ^ example it will be sudo apt install php7.2-bcmath

after this check if module existed or not by type php -m | grep bcmath

带上头具痛哭 2025-01-27 03:27:19

php 7.2 如果您有其他版本,只需相应更改即可

对于 CentOS

sudo yum install php72-bcmath

对于 Ubuntu

sudo apt install php7.0-bcmath

php 7.2 if you have other version just change it accordingly

For CentOS

sudo yum install php72-bcmath

For Ubuntu

sudo apt install php7.0-bcmath
断念 2025-01-27 03:27:19

运行此命令,希望它能有效

sudo apt-get install php-bcmath

Run this command, hope it will works

sudo apt-get install php-bcmath
你与清晨阳光 2025-01-27 03:27:19

希望这能解决这个问题。

sudo apt安装php-bcmath

hope this will fix the problem.

sudo apt install php-bcmath

囚我心虐我身 2025-01-27 03:27:19

这里奇怪的事情
大个月前,我以相同的方式安装了所有PHP版本。在这里是PHP的4个相同配置的版本:5.6、7.0、7.1、7.2,具有相同的扩展(当做出可能时)。
奇怪的是, bcmath 均为所有PHP版本(不包括7.1)。
在解决方案搜索中,我在此问题中到达这里,逻辑的内容已确认安装BCMATH,但在我的Linode Debian 9服务器中
apt安装php7.1-bcmath
不起作用,带有3条错误消息;

  • E:无法找到包装php7.1-bcmath
  • E:无法找到带有“ php7.1-bcmath”的
  • 包裹

“通过提示和技巧的任何组合,刷新的APT缓存,更改Debian的镜像服务器,安装百胜,等等...

在一些暂时我有照明之后:修改 /etc/etp/apt/sources .LIST 启用默认的Linode存储库,然后在 apt apt Update 之后(立即没有解决方案),我还恢复了/ett /apt/sources.list再次评论linode镜像源。神奇的是,在新的APT更新后,该命令现在正在工作。

我确认: apt install php7.1-bcmath 是正确的命令,但是您的debian可能需要踢屁股

Strange thing here
Some month ago I have installed all PHP version in the same manner. In here are the 4 identically configured version of php: 5.6, 7.0, 7.1, 7.2, with the same extensions ( when this was made possible ).
The strange thing was that bcmath is present for all php version excluding 7.1.
In the solution search I arrive here in this question, where the logic's things was confirmed installing bcmath, but in my Linode Debian 9 server the command
apt install php7.1-bcmath
doesn't work, with 3 error messages;

  • E: Impossible to find the package php7.1-bcmath
  • E: Impossible to find some package with glob "php7.1-bcmath"
  • E: Impossible to find a package with the regular expression "php7.1-bcmath"

The goals no meet with any combination of tips and trick, refreshing apt cache, change Debian's mirrored server, installing yum, so on...

After some tentatives I had an illumination: modificating of /etc/apt/sources.list enabling the default Linode repository, then after an apt update (with no solution in the immediate), I have restored the /etc/apt/sources.list commenting out the Linode mirror sources again. Magically, after the new apt update the command now are working.

By this I confirm: apt install php7.1-bcmath is the right command, but your Debian can need a kick in the ass

忱杏 2025-01-27 03:27:19

注意:这将在Ubuntu服务器上使用。

首先导航到服务器的根目录:

/

通过在软件包名称中指定特定的PHP版本,例如PHP 7.4:

sudo apt-get安装php7.4-bcmath

成功安装软件包后,重新启动Apache Web服务器以激活更改:

sudo服务apache2 restart

Note: This will work on Ubuntu servers.

Start by navigating to the server's root directory:

/

Install a particular PHP version, for example, PHP 7.4, by specifying it in the package name:

sudo apt-get install php7.4-bcmath

After successfully installing the package, restart your Apache web server to activate the changes:

sudo service apache2 restart

明天过后 2025-01-27 03:27:19

使用此命令安装,这对我有用

apt-get install php-bcmath

Install with this command, thats work for me

apt-get install php-bcmath
尤怨 2025-01-27 03:27:19

我尝试了下面的软件包,它在PHP版本5.6中使用

yum install php56w-bcmath

I tried below package and it worked in Php version 5.6

yum install php56w-bcmath
美男兮 2025-01-27 03:27:19

对于那些已经尝试安装BC-MATH和Commoser的人来说,这是错误的。

尝试此命令

rm composer.lock

肯定会起作用

For those who have already tried installing bc-math and still composer is giving errors.

Try this command

rm composer.lock

It will definitely work

层林尽染 2025-01-27 03:27:19

一个简单的 apt-get install php-bcmath 就可以解决 php 8.3 的问题

A simple apt-get install php-bcmath does the trick for php 8.3

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文