找不到 PHP 7 DomDocument

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35668702/
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 00:31:50  来源:igfitidea点击:

PHP 7 DomDocument not found

phpsymfony

提问by Rohan Warwar

I try run command: app/console cache:clear

我尝试运行命令: app/console cache:clear

This return me error:

这返回我错误:

An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowable
Error: Fatal error: Class 'DOMDocument' not found in /var/www/html/vendor/s
ymfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52

执行“'cache:clear --no-warmup'”命令时
出现错误:PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowable
Error: Fatal error: Class 'DOMDocument' not found in /var/www /html/vendor/s
ymfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52

Ubuntu 14.04 LTS I use PHP 7 and install php5-dom not resolved my problem: sudo apt-get install php5-dom

Ubuntu 14.04 LTS 我使用 PHP 7 并安装 php5-dom 没有解决我的问题: sudo apt-get install php5-dom

回答by Barry Last

I had the same issue on Ubuntu and fixed it doing the following

我在 Ubuntu 上遇到了同样的问题并通过以下方式修复了它

apt-get install php-xml

or

或者

sudo apt-get install php-xml

if not as root

如果不是 root

回答by shuramaan

just a minor addition to the answer. i'm using nginx with php version 7 and php-fpm. you must restart the php-fpm service in order for the updates to work, restarting nginx alone won't help

只是对答案的一个小补充。我正在使用带有 php 版本 7 和 php-fpm 的 nginx。您必须重新启动 php-fpm 服务才能使更新工作,单独重新启动 nginx 无济于事