I have just transferred a Drupal 7 site from my local development environment (OSX / MAMP) to a CentOS server.
It seems to work for the most part as an anonymous user, it's a fairly simple site at this point, however I can instigate the following error in 2 ways:
PHP Fatal error: Class 'DOMDocument' not found in modules/filter/filter.module on line 1041
Either by:
* Logging In (log in appears to be successful, as the error occurs on every page until I go to /user/logout , at which point the site becomes usable again)
* Submitting a Views exposed filter that returns no result (If a result is found, no error occurs)
Googling doesn't really find anything, however I did realize that my file_temporary_path wasn't set correctly, it's now set to s:4:"/tmp";
Apparently sites/default/files permission might be related as well, but that's set to 777.
Please help!
Comments
SOLVED
This was fixed by installing the package php-xml
A bit after the fact
...but this helped me too. Thanks, carn1x.
Thanks for posting the fix
Installing the package php-xml resolved it for me too.
For people using Redhat Linux, all you have to do is:
yum install php-xml and restart apache
Hi! Just wanted to say thank
Hi! Just wanted to say thank you for this info.
Case:
Working site moved to other VPS, drush cleared cache and error occurred. Reading logs + googling the error resulted in this fix as nr 1 hit in list.
thanks
6 years later, this helped me too.
Me too!
7 years latter still works! Thank you!
It helps me after 10 years,
It helps me after 10 years, thanks.
For installing php-xml on php 5.6 I used a command:
This is helpful
Thanks, for post, I found helpful..
Its took my one hour hope this will help for new ubuntu user
Those are using Ubuntu 16.04
if you install php then it will run your php 7
I have install php 5 to install drupal 7 it works but i never checked which version of php is running.
I was installing php-xml no error on installation, But did't work for me.
I was still faceing same issue "PHP Fatal error: Class 'DOMDocument' not found in modules/filter/filter.module on line 1041"
To solve do following
Purge your all php and reinstall php7 and then try install php-xml extention.
or
Switch PHP version:
From php5.6 to php7.0 :
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo ln -sfn /usr/bin/php7.0 /etc/alternatives/php
and then install php-xml extention
zakir.gori
Thanks zakir.gori. I had a
Thanks zakir.gori. I had a similar problem on my Ubuntu 16.04. I already had php7.0 installed, so all I had to do was install the php-install (sudo apt-get install php-xml) to resolve the issue.
Still relevant - from php7.0 to 7.2
I just upgraded a server to Ubuntu 18.04, and started seeing the symptoms in this thread (Drupal sites start producing errors after signing in). PHP had been upgraded on the server in the process, so executing the above statement, modified for the move from PHP 7.0 to 7.2, fixed it.
sudo a2dismod php7.0 ; sudo a2enmod php7.2 ; sudo service apache2 restart
Add PHP-XML in PHP5.6
If you are using ubantu 16.04 with php 5.6 then you need to use following command to install php-xml
then restart your apache server to see changes.
Great! this did the trick for
Great! this did the trick for me.
Thank you very much.
It works for me
Thanks a lot..!!
Thanks a lot life saving answer
Prashant Chauhan
Engineer Backend
This was helpful
As a general rule, packages that used to be called
php-something
could have the version added to it when you upgrade.I also had to install
php5.6-mysql
for it to work. Read the error messages and install what's missing. I had this issue today on ubutnu 14.04, after an update.And I also had to restart apache, rebuild registry and clear caches to have it all working again.
Thanks for posting this!
No resolved from my side
I was trying all above stuff. but no luck. I got the same issue when i installed existing drupal 7 site on my local machine with ubuntu 16.4 and php 7.0. Once go into the Admin side of site and tried to flush the cache then i was not able to see the home page (404 not found) Then i check the error log the issue was showing like: "
PHP Fatal error: Class 'DOMDocument' not found in modules/filter/filter.module on line 1041"
Please help.
hi!
Could you solve it? i have the same error.
Resolved for me
@doakym
By following steps it got resolved for me.
its also work for me.. tqsm
its also work for me.. tqsm
You may need to restart PHP FPM service
Sometime only apache restart doesnt help, you must restart the php-fpm service in order for the updates to work, try the below command and see..
Restart PHP FPM command: service php-fpm restart.
Cheers
~
Make sure to restart your server after installing PHP XML. Using the Scotch Box 3.0 with PHP 7, these two commands fixes the error
Error: Class 'DOMDocument' not found in /var/www/public/core/lib/Drupal/Component/Utility/Html.php
for me:@ressa I did that but I still
@ressa I did that but I still get the same error. Any ideas? I'm using Scotch Box 3.0 also.
_-_
I am not sure, I ended up just using PHP 5.6 ... But the issue Scotch Box 3.0 is missing php7.0-xml has many suggestions for solutions. Perhaps one of them can help you?
Drupal 8 equivalent solved
Drupal 8 equivalent solved the same way: Class 'DOMDocument' not found in core/lib/Drupal/Component/Utility/Html.php on line 286
Install php7.2-xml.
petermoulding.com/web_architect