Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MappingException: "Extension DOM is required."

Tags:

symfony4

I have an application, my dev environment is nginx and it works great. Production is apache, PHP7.3, mysql 5.7

I am getting the following error:

Uncaught PHP Exception Symfony\Component\Validator\Exception\MappingException: "Extension DOM is required." at /var/www/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php line 181 {"exception":"[object] (Symfony\\Component\\Validator\\Exception\\MappingException(code: 0): Extension DOM is required. at /var/www/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php:181, LogicException(code: 0): Extension DOM is required. at /var/www/vendor/symfony/config/Util/XmlUtils.php:50)"} []

Everythng I read shows it should be because of php-xml (its installed), and enabled.

Anything else I can look into?

like image 427
TDawg Avatar asked Jan 27 '23 10:01

TDawg


2 Answers

I had to install the package explicitly for php 7.3. So, at least for Ubuntu, that'll be:

sudo apt install php7.3-xml

You should then be good after a webserver reload/restart.

like image 72
rosch Avatar answered May 05 '23 21:05

rosch


The host had installed apache php 7.2 and php-cli as 7.3, so when doing apt install php-xml it installed only for 7.3. that was reason for failing.

like image 20
TDawg Avatar answered May 05 '23 23:05

TDawg