Title: Uncaught Error: Class &#8216;DOMDocument&#8217;
Last modified: December 22, 2016

---

# Uncaught Error: Class ‘DOMDocument’

 *  Resolved [Zach Malmgren](https://wordpress.org/support/users/zmalmgren/)
 * (@zmalmgren)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/uncaught-error-class-domdocument/)
 * In the “Above The Fold Optimization” screen, on the “Critical CSS” tab, if I 
   use the “Extract Full CSS” by selecting “Home Page (Index)” and clicking “Print”,
   I get a new window with the URL of “[https://www.planetscon.com/?extract-css=39bf18531a83fc138e3cfb5e2be27068&output=print&#8221](https://www.planetscon.com/?extract-css=39bf18531a83fc138e3cfb5e2be27068&output=print&#8221);.
   However, the page displays as normal.
 * In the error logs of the nGinx server I get the following:
 *     ```
       2016/12/22 12:31:32 [error] 4158#4158: *805 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'DOMDocument' not found in /var/www/planetscon_com/public_html/wp-content/plugins/above-the-fold-optimization/includes/extract-full-css.class.php:92
       Stack trace:
       #0 [internal function]: Abovethefold_ExtractFullCss->end_buffering('<!DOCTYPE html>...', 9)
       #1 /var/www/planetscon_com/public_html/wp-includes/functions.php(3673): ob_end_flush()
       #2 /var/www/planetscon_com/public_html/wp-includes/class-wp-hook.php(298): wp_ob_end_flush_all('')
       #3 /var/www/planetscon_com/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
       #4 /var/www/planetscon_com/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
       #5 /var/www/planetscon_com/public_html/wp-includes/load.php(670): do_action('shutdown')
       #6 [internal function]: shutdown_action_hook()
       #7 {main}
         thrown in /var/www/planetscon_com/public_html/wp-content/plugins/above-the-fold-optimization/includes/extract-full-css.class.php on line 92" while reading upstream, client: <my ip addr>, server: , request: "GET /?extract-css=39bf18531a83fc138e3cfb5e2be27068&output=download HTTP/2.0", upstream: "fastcgi://unix:/run/php/planetscon_com.sock:", host: "www.planetscon.com"
       ```
   
 * I am running Ubuntu 16.04.1 LTS / nginx/1.10.0 (Ubuntu) / PHP 7.0.8-0ubuntu0.16.04.3(
   cli) ( NTS )
 * Thank you, and please let me know what other information would be helpful.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [optimalisatie](https://wordpress.org/support/users/optimalisatie/)
 * (@optimalisatie)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/uncaught-error-class-domdocument/#post-8582369)
 * Hi zmalmgren,
 * Thank you for reporting the problem!
 * The class `DOMDocument` should be available by default in PHP 7.
 * [http://php.net/manual/en/class.domdocument.php](http://php.net/manual/en/class.domdocument.php)
 * Regrettably, we are not able to help with (advanced) server configuration.
 * I did a quick search in Google and a fix may be provided in the following topic:
 * [http://stackoverflow.com/questions/35668702/php-7-domdocument-not-found](http://stackoverflow.com/questions/35668702/php-7-domdocument-not-found)
 * _[ [Signature moderated](http://codex.wordpress.org/Forum_Welcome#Signatures)]_
    -  This reply was modified 9 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 *  Thread Starter [Zach Malmgren](https://wordpress.org/support/users/zmalmgren/)
 * (@zmalmgren)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/uncaught-error-class-domdocument/#post-8582562)
 * Jan,
 * Thank you for your help. I got it to work with the following:
 *     ```
       sudo apt-get install php-xml
       sudo service php7.0-fpm restart
       ```
   
 * However, the page still threw an error “PHP message: PHP Fatal error: Uncaught
   Error: Call to undefined function mb_convert_encoding()”. So I had to add:
 *     ```
       sudo apt-get install php-mbstring
       sudo service php7.0-fpm restart
       ```
   
 * Thanks again for your help!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Uncaught Error: Class ‘DOMDocument’’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/above-the-fold-optimization_fcfbf6.
   svg)
 * [Page Speed Optimization](https://wordpress.org/plugins/above-the-fold-optimization/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/above-the-fold-optimization/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/above-the-fold-optimization/)
 * [Active Topics](https://wordpress.org/support/plugin/above-the-fold-optimization/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/above-the-fold-optimization/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/above-the-fold-optimization/reviews/)

## Tags

 * [php-fpm](https://wordpress.org/support/topic-tag/php-fpm/)

 * 2 replies
 * 2 participants
 * Last reply from: [optimalisatie](https://wordpress.org/support/users/optimalisatie/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/uncaught-error-class-domdocument/#post-8582369)
 * Status: resolved