38

I tried to run the command app/console cache:clear but it gave an 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/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52

I use PHP 7 on Ubuntu 14.04 LTS. Installing php5-dom did not resolve my problem:

sudo apt-get install php5-dom
2
  • Do you have xml module for php in your system ?? Commented Feb 27, 2016 at 10:45
  • 2
    Note that it may be necessary to sudo service apache2 restart after installing the package. Commented Aug 2, 2016 at 18:14

2 Answers 2

122

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

apt-get install php-xml

or

sudo apt-get install php-xml

if not as root

Sign up to request clarification or add additional context in comments.

6 Comments

or php7.0-xml
or php5.6-xml
Notice that you also need to restart your webserver for this to take effect: sudo service apache2 restart
I have a similar issue and I did install php-xml but still same error any idea?
sudo systemctl restart php7.4-fpm(replace 7.4 with your version)
|
12

Just a minor addition to the answer. I'm using nginx with PHP 7 and php-fpm. You must restart the php-fpm service in order for the updates to work. Restarting nginx alone won't help.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.