37

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 ?? Feb 27, 2016 at 10:45
  • 2
    Note that it may be necessary to sudo service apache2 restart after installing the package.
    – BurninLeo
    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

5
  • 16
    or php7.0-xml
    – winkbrace
    Jun 29, 2016 at 10:57
  • 2
    or php5.6-xml Nov 15, 2016 at 6:26
  • 8
    Notice that you also need to restart your webserver for this to take effect: sudo service apache2 restart Jul 31, 2017 at 20:36
  • I have a similar issue and I did install php-xml but still same error any idea?
    – Hadh
    Nov 6, 2020 at 10:57
  • 1
    sudo systemctl restart php7.4-fpm(replace 7.4 with your version)
    – ospider
    Jan 5, 2021 at 8:39
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.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.