How to Solved Error "DOMDocument" Not Found in Laravel?

30-Jan-2023

.

Admin

How to Solved Error "DOMDocument" Not Found in Laravel?

Hi dev,

This post will give an illustration of a Laravel Class "DOMDocument" not found error. I briefly discussed the class 'domdocument' not found issue. php 7. You can comprehend the idea behind the class 'domdocument' not found php error. Let's talk about the php domdocument error. If the php artisan class domdocument cannot be found, follow the steps following.

I recently utilised the "DOMDocument" class in my Laravel 9 application to read HTML strings. It functions properly with my local system. However, I discovered the following problem after uploading it to the live server:

I look it up on Google and learn that we must set up the php-dom and php-xml extensions. Let's look at the below solution now.

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...

#Laravel