On Ubuntu 16.04, I installed Drush using Composer: composer global require drush/drush:~8. Installation succeeded, but running drush --version, I got this error:

PHP Fatal error: Uncaught ReflectionException: Class DOMDocument does not exist in /.../composer/vendor/consolidation/output-formatters/src/Transformations/DomToArraySimplifier.php:24

What do I do now?

3 Answers 3


DOMDocument is included in the extension php-xml. To install it on ubuntu, run:

sudo apt-get install php-xml

Same problem on my machine, where I have php-5.6 and php-7.0 installed.

To fix this issue I have installed php5.6-xml and php7.0-xml too.

  • this was helpful.
    – nizz0k
    Commented Nov 11, 2018 at 6:51

Checking your php version first by command line:

php -v

and install the corresponding php-xml extension (eg: php5.6-xml; php7.0-xml; php7.1-xml; php7.2-xml).

Your Answer

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

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