Laravel - Class "DOMDocument" Not Found - Solved

By Hardik Savani January 19, 2023 Category : Laravel

Hey Artisan,

This article will provide an example of Class "DOMDocument" not found laravel. I explained simply about class 'domdocument' not found php 7. you can understand a concept of class 'domdocument' not found php artisan. let’s discuss about php domdocument not found. follow the below step for php artisan class domdocument not found.

Recently, I was working on my laravel 9 application and I used the "DOMDocument" class to read HTML strings. it's working fine with my local system. But when i uploaded it on the live server then I found the following issue:

"Class "DOMDocument" not found"

I google it and find we need to install php-dom and php-xml extensions. so let's see the below solution.

Solution:

You need to run both command one by one:

sudo apt-get install php-dom

sudo apt-get install php-xml

Solution for PHP 8.2

You need to run both command one by one:

sudo apt-get install php8.2-dom

sudo apt-get install php8.2-xml

Solution for PHP 8.1

You need to run both command one by one:

sudo apt-get install php8.1-dom

sudo apt-get install php8.1-xml

Solution for PHP 8.0

You need to run both command one by one:

sudo apt-get install php8.0-dom

sudo apt-get install php8.0-xml

Solution for PHP 7.4

You need to run both command one by one:

sudo apt-get install php7.4-dom

sudo apt-get install php7.4-xml

Solution for PHP 7.2

You need to run both command one by one:

sudo apt-get install php7.2-dom

sudo apt-get install php7.2-xml

I hope it can help you...

Tags :