Title: Fatal error: Class &#039;DOMDocument&#039; not found
Last modified: August 21, 2016

---

# Fatal error: Class 'DOMDocument' not found

 *  [Carlos](https://wordpress.org/support/users/crr1983/)
 * (@crr1983)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/)
 * Hi!
 * When importing I get this error:
    Fatal error: Class ‘DOMDocument’ not found 
   in /var/www/html/wp-content/plugins/wordpress-importer/parsers.php on line 61
   I’ve check the plugin code and I don’t found any error visivle error on this 
   declaration.
 * Any idea?
 * [http://wordpress.org/extend/plugins/wordpress-importer/](http://wordpress.org/extend/plugins/wordpress-importer/)

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

 *  [Jason LeMahieu (MadtownLems)](https://wordpress.org/support/users/madtownlems/)
 * (@madtownlems)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651930)
 * Well, line 61 of the file you listed is this:
 * $dom = new DOMDocument;
 * What version of PHP are you using?
 *  [davidlowry](https://wordpress.org/support/users/davidlowry/)
 * (@davidlowry)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651939)
 * For me, the problem with this error is either you don’t have the dom extension
   to php5 installed or your php.ini file needs the semi-colon removed from the 
   line `;extension=dom.so`
 *  [Jason LeMahieu (MadtownLems)](https://wordpress.org/support/users/madtownlems/)
 * (@madtownlems)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651940)
 * It looks like there are lots of different ways to not have access to DOMDocument.
   You’ll need to do some research, and try talking to your host.
 *  [iq_se7en](https://wordpress.org/support/users/iq_se7en/)
 * (@iq_se7en)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651957)
 * на хостинге идем в настройки сервера, лезем в настройки модуля PHP, подключаем
   расширение DOM
 *  [jmcollin92](https://wordpress.org/support/users/jmcollin92/)
 * (@jmcollin92)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651968)
 * Same problem for me. Any clues to resolve this issue ?
 * JM.
 *  [jmcollin92](https://wordpress.org/support/users/jmcollin92/)
 * (@jmcollin92)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651969)
 * The solution is there : [http://wordpress.org/support/topic/plugin-import-html-pages-requires-php-xml-if-you-get-error-domdocument-not-found?replies=1](http://wordpress.org/support/topic/plugin-import-html-pages-requires-php-xml-if-you-get-error-domdocument-not-found?replies=1)
   
   Followed by an (for my case) : sudo service httpd restart
 *  [Derwood](https://wordpress.org/support/users/derwood/)
 * (@derwood)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651974)
 * You also need the php-dom plugin in addition to php-xml. It was failing for me
   because I didn’t have php-dom installed. Now it’s working.
 *  [sufinawaz](https://wordpress.org/support/users/sufinawaz/)
 * (@sufinawaz)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651979)
 * If you run into the following problem while trying to install these packages 
   in a Centos Machine:
    `php53-common conflicts with php-common`
 * try installing php53-xml instead.
 * Just FYI 🙂
 *  [taotiago](https://wordpress.org/support/users/taotiago/)
 * (@taotiago)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651986)
 * Replace in file parsers.php in plugin wordpress-importer at Class WXR_Parser_SimpleXML
 * >  $dom = new DOMDocument;
   >  $old_value = null; if ( function_exists( ‘libxml_disable_entity_loader’)){
   > $old_value = libxml_disable_entity_loader( true ); } $success = $dom->loadXML(
   > file_get_contents( $file ) ); if ( ! is_null( $old_value ) ) { libxml_disable_entity_loader(
   > $old_value ); }
   >  if ( ! $success || isset( $dom->doctype ) ) {
   >  return new WP_Error( ‘SimpleXML_parse_error’,
   > __( ‘There was an error when reading this WXR file’, ‘wordpress-importer’ ),
   > libxml_get_errors() ); }
   >  $xml = simplexml_import_dom( $dom );
   >  unset( $dom );
 * >  For:
   >  $xml = simplexml_load_file($file);
 * 🙂
 *  [drmikegreen](https://wordpress.org/support/users/drmikegreen/)
 * (@drmikegreen)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651989)
 * Thanks very, very much, taotiago!
 * Your solution was what I needed, since my OS (CentOS) threw errors with all attempts
   to install php-xml.
 * One small correction to your posting that would help: Replace “For:” with “With:”
   just before `$xml = simplexml_load_file($file);`
 * _**A suggestion for the plugin developers**_: Test for the existence of `DOMDocument`
   and use `$xml = simplexml_load_file($file);` if DOMDocument does not exist.

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

The topic ‘Fatal error: Class 'DOMDocument' not found’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-importer/assets/icon.svg?rev=2791650)
 * [WordPress Importer](https://wordpress.org/plugins/wordpress-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-importer/reviews/)

## Tags

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

 * 10 replies
 * 9 participants
 * Last reply from: [drmikegreen](https://wordpress.org/support/users/drmikegreen/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-class-domdocument-not-found/#post-3651989)
 * Status: not resolved