22

I installed a symfony 3 project but cant run any php bin/console commands. When I try, I get the following error:

PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace. Did you forget a "use" statement? in project_folder/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52

Any idea how to fix this?

3
  • Any idea how to see the code? Commented Jun 24, 2016 at 17:53
  • What are you trying to do? Can we see the file that refers to "DOMDocument". Just "edit" your post, and post that code. Commented Jun 24, 2016 at 19:00
  • I installed symfony with 'symfony new project_name' and then entered the folder and tried 'php bin/console to see if the console was working. After hours of looking for solutions I checked the php packages that I had installed and realized that php-xml was not there. Now it is working. Thanks for trying to help anyway! Commented Jun 24, 2016 at 19:44

1 Answer 1

75

After hours of looking for solutions I checked the php packages that I had installed and realized that php-xml was not there.

sudo apt install php-xml

Now it works :)

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

2 Comments

Works. But I hate these php programs and their unreasonable error message
Personally I had to run sudo apt install php7.0-xml

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.