I have installed fresh magento 2.2 which is working fine but command lines are not working. I am using ubuntu.

Getting strange error:

PHP Fatal error: Uncaught Error: Class 'DOMDocument' not found in /opt/lampp/htdocs/magento2/vendor/magento/framework/Config/Dom.php:384

Did search but not found any solution. As magento 2.2 is successfully installed so it fulfilled all required settings which magento 2.2 required. What could be the issue?

Any help would be appreciated.

  • @ jack, did you run the setup upgrade command after the installation ? – MGento Nov 6 '17 at 10:37
  • no i didn't run setup updgrade command. After installation i tried to disable the cache so did hit the cache command and got that error – jack Nov 7 '17 at 7:46
  • Just now i have run the upgrade command still giving that error. Need expert advice why am i having this issue? is there any solution of this problem in world? – jack Nov 7 '17 at 7:54
  • Make sure you have provided proper permission to the pub/static, generated, and var folder. Double check, your generated folder have write permission. After that, run the following commands, php bin/magento setup: upgrade and after that, php bin/magento setup:static-content:deploy -f – MGento Nov 7 '17 at 9:20

You need to install all php module as per required of Magento2. For this error it seems you have not installed php-xml module.

So install module by below command

sudo apt-get install php-xml

There is a list of module that you will need to install before Magento2 installation


For PHP 7 run below commands

sudo apt-get update

sudo apt-get install php7.0-mcrypt php7.0-gd php7.0-intl php7.0-curl php7.0-xsl php7.0-mbstring php7.0-openssl php7.0-zip php7.0-soap

sudo service apache2 restart

Hope this will help you.

| improve this answer | |
  • I have already installed php-xml module and restarted apache but still showing same error wh? – jack Nov 6 '17 at 6:40
  • let me know php-version? – akgola Nov 6 '17 at 6:42
  • PHP version is 7.0.2 – jack Nov 6 '17 at 6:44
  • check updated answer and run commands for php 7 – akgola Nov 6 '17 at 6:50
  • As magento 2.2 already installed so all required php modules are already there. Is there anything you can figure out? – jack Nov 6 '17 at 6:55

use php -v to check you version of php, you need php-7.0 instead of 7.2, if you are using php 7.2 you need to remove the package with apt-get remove php7.2-common --purge

then reinstall php7.0 dependencies; hopefully this could fix your issue

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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