PHP致命错误:在Symfony上未找到类'DOMDocument'

3

我已经查看了所有相关的问题,但是这些解决方案并没有解决我的问题。

我正在尝试设置一个EC2实例,安装php7.0、mysql、composer、克隆代码库等等。

这个EC2实例是Centos 6.5。

但是当:

php bin/console cache:clear --env=prod --no-debug

我正在收到:

PHP Fatal error:  Uncaught Error: Class 'DOMDocument' not found in /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52
Stack trace:
#0 /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(263): Symfony\Component\Config\Util\XmlUtils::loadFile('/var/www/html/T...', Array)
#1 /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/var/www/html/T...')
#2 /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(72): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xml')
#3 /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php(59): Symfony\Bundle\FrameworkBundle\Dependen in /var/www/html/TFM_RedSocialMusical/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php on line 52

搜索类似的问题后,提出的解决方案如下:

sudo yum install php-xml

我正在获取:

Loaded plugins: fastestmirror, presto
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.heanet.ie
 * epel: ftp.heanet.ie
 * extras: ftp.heanet.ie
 * ius: mirrors.ircam.fr
 * updates: ftp.heanet.ie
Resolving Dependencies
--> Running transaction check
---> Package php-xml.x86_64 0:5.3.3-49.el6 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-49.el6 for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.3.3-49.el6.x86_64
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed
---> Package php-common.x86_64 0:5.3.3-49.el6 will be installed
--> Processing Conflict: php70u-common-7.0.20-1.ius.centos6.x86_64 conflicts php-common < 7.0.20
--> Processing Conflict: php70u-json-7.0.20-1.ius.centos6.x86_64 conflicts php-json < 7.0.20
--> Finished Dependency Resolution
Error: php70u-common conflicts with php-common-5.3.3-49.el6.x86_64
Error: php70u-json conflicts with php-common-5.3.3-49.el6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我已经安装了php70u-common,但如何避免与php-common-5.3.3-49发生冲突呢?

提前感谢。


2
看到这里有 php70u-commonphp70u-json,很可能还有一个叫做 php70u-xml 的包。 - ceejayoz
该死!我已经尝试了php70-xml、php7.0-xml,但都没有成功!@ceejayoz的方法可行。 - Albeis
1个回答

4

根据评论所说,安装php70u-xml解决了问题。


对我来说,它显示为:无法找到包php70u-xml。 - some_guy
1
你使用的是CentOS?Ubuntu?也许这取决于你使用的版本... 在这里检查:https://askubuntu.com/questions/998900/i-get-the-unable-to-locate-package-message-when-trying-to-install-php-xml-rss - Albeis
1
是的,Ubuntu。谢谢。我会检查一下。昨天我重新安装了PHP(本地),它可以工作了。我认为问题可能是由于不同版本的PHP之间的某些冲突引起的。我在这方面并不是很有经验。我曾经安装过5.6和7.2版本,现在重新安装了7.0版本。 - some_guy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接