您的系统中缺少请求的 PHP 扩展 dom

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44952650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 03:03:22  来源:igfitidea点击:

The requested PHP extension dom is missing from your system

phpcomposer-php

提问by Miguel Stevens

So I just installed Scotchbox (a vagrant setup). https://github.com/scotch-io/scotch-box

所以我刚刚安装了 Scotchbox(一个流浪者设置)。 https://github.com/scotch-io/scotch-box

I'm trying to install a composer dependancy when I get the following error.

当我收到以下错误时,我正在尝试安装 Composer 依赖项。

Problem 1
- phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpunit/php-code-coverage (locked at 4.0.8) -> satisfiable by phpunit/php-code-coverage[4.0.8].

What I've tried

我试过的

Some other thread suggested that this is included in the php-xml package. I tried installing this doing

其他一些线程建议这包含在 php-xml 包中。我试过安装这个

sudo apt-get install php7.0-xml
sudo service apache2 restart

But that didn't work. Any idea what other solutions might work? I'm starting to pull my hair out.

但这没有用。知道哪些其他解决方案可能有效吗?我开始拔头发了。

回答by Mubashar Abbas

For me the selected answer didn't work.

对我来说,选择的答案不起作用。

This did work:

这确实有效:

sudo apt-get install php-xml

This was on Ubuntu 16.04 with PHP 7.

这是在带有 PHP 7 的 Ubuntu 16.04 上。

回答by kuba

Try

尝试

sudo apt-get install php7.0-common

回答by Wisnu Pramono E.S

I am using Ubuntu 17.10 and PHP 7.1 is running well using:

我使用的是 Ubuntu 17.10,PHP 7.1 运行良好,使用:

sudo apt-get install php7.1-xml

and then (if using apache)

然后(如果使用 apache)

sudo service apache2 restart

or if on nginx you can use this:

或者如果在 nginx 上你可以使用这个:

sudo service nginx restart

回答by Joel Jerushan

use sudo apt-get install php7.2-xmlif you are using ubuntu and php-fpm7.2

使用sudo apt-get install php7.2-xml如果你正在使用Ubuntu和php-fpm7.2

回答by liaoyuming

First,

第一的,

yum search php-xml

Then, choose one to yum install

然后,选择一个进行yum install

yum install php71-php-xml.x86_64 

Centos7 php7

Centos7 php7