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

时间:2017-07-05 19:20:45

标签: php symfony amazon-ec2 php-7

我一直在检查所有相关问题,但解决方案并没有解决我遇到的问题。

我正在尝试设置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发生冲突?

提前致谢

1 个答案:

答案 0 :(得分:2)

如评论所述,安装php70u-xml解决了这个问题。