PHP |“您的系统中缺少请求的 PHP 扩展 bcmath." [英] PHP | "The requested PHP extension bcmath is missing from your system."

查看:38
本文介绍了PHP |“您的系统中缺少请求的 PHP 扩展 bcmath."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候开发人员,

我正在尝试在我最近启动的开发服务器上为我的 PHP 项目使用 Composer,但由于某种原因我无法使用.我成功安装了 Composer,但是,当我尝试运行 require 命令时,出现以下错误:

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.

我假设这与我在运行 composer require 命令时收到的 PHP 警告有关,但没有谷歌搜索结果引导我找到正确的方向.

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.

此外,我还提供了我的 /etc/php/7.0/cli/php.ini 文件,以防该文件出错.

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/bc5bac59d684cbf575cef936>(由于帖子的字符数限制,我无法在此帖子中包含该文件.)

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

谢谢.

推荐答案

您可以使用函数 get_loaded_extensions 查看是否加载了 bcmath 模块.或者在终端 php -mphp -m |grep name_of_the_modul

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

这篇关于PHP |“您的系统中缺少请求的 PHP 扩展 bcmath."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆