问候开发者,
我试图在我最近启动的开发服务器上使用composer作为我的PHP项目,由于某种原因我无法做到。我成功安装了composer,但是,当我尝试运行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.
我假设它与我在运行composer require命令时收到的PHP警告有关,但没有谷歌搜索结果引导我到正确的方向。
另外,我提供了我的/etc/php/7.0/cli/php.ini文件,因为该文件中存在错误。
https://gist.github.com/anonymous/bc5bac59d684cbf575cef931ef36daf6(由于帖子的字符限制,我无法在此帖子中包含该文件。)
谢谢。
您可以使用函数qazxsw poi来查看qazxsw poi模块是否已加载。或者在终端get_loaded_extensions或bcmath
您可以根据您使用的操作系统进行安装:
Ubuntu的
php -m
CentOS的
php -m | grep name_of_the_modul
我试过下面的包,它在Php 5.6版中工作
sudo yum install php72-bcmath
sudo apt install php7.0-bcmath
工作就像一个魅力:)
对于PHP 7.1,以下内容适用于我:
yum install bcmath
对于php Centos中的任何版本使用
这个解决方案对我有用
yum安装php-bcmath
PHP将采用机器中安装的默认版本,搜索该软件包并进行安装。
删除文件composer.lock文件(如果已创建)然后再次运行,
作曲家安装
如果你跑
作曲家更新
它将更新composer.json中安装的任何默认软件包,这可能会给您带来麻烦。
按类型检查你的php版本:apt-get update
apt-get install php7.2-bcmath
你会看到这样的东西:
sudo apt install php7.1-bcmath
然后php --version
其中X.X是php版本,所以对于这个^例子它将是PHP 7.2.9-1+ubuntu16.04.1 ....
在此之后,按类型qazxsw poi检查模块是否存在
php 7.2如果你有其他版本只是相应地更改它
对于sudo apt install phpX.X-bcmath
sudo apt install php7.2-bcmath
对于php -m | grep bcmath
CentOS
希望这能解决问题。
sudo apt安装php-bcmath
奇怪的是这里 一个月前我以相同的方式安装了所有PHP版本。在这里是4个相同配置的php版本:5.6,7.0,7.1,7.2,具有相同的扩展名(当这是可能的时候)。 奇怪的是,bcmath适用于除7.1之外的所有php版本。 在解决方案搜索中我到这里来到这个问题,其中逻辑的东西被确认安装bcmath,但在我的Linode Debian 9服务器中,命令apt install php7.1-bcmath不起作用,有3条错误消息;
目标没有满足任何提示和技巧的组合,刷新apt缓存,更改Debian的镜像服务器,安装yum,等等......
经过一些尝试后,我有了一个亮点:修改/etc/apt/sources.list启用默认的Linode存储库,然后在apt更新(没有立即解决方案)之后,我恢复了/etc/apt/sources.list再次评论出Linode镜像源。奇怪的是,在新的apt更新之后,命令现在正在运行。
通过这个我确认:apt安装php7.1-bcmath是正确的命令,但你的Debian可能需要踢屁股
对于这个问题,我们应该使用sudo apt install php-bcmath