Class 'DOMDocument' not found in Joomla
I also had this problem and solved it in a different way.
Within cPanel I had an option to change the PHP version and set the options, from there I could choose a "dom" tickbox which solved my problem.
All cPanels can be slightly different so you may not have this option but hopefully it helps someone.