WordPress Importer
Fatal error: Class 'DOMDocument' not found (11 posts)

  1. Carlos
    Posted 3 years ago #


    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?


  2. Well, line 61 of the file you listed is this:

    $dom = new DOMDocument;

    What version of PHP are you using?

  3. davidlowry
    Posted 3 years ago #

    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

  4. 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.

  5. iq_se7en
    Posted 3 years ago #

    на хостинге идем в настройки сервера, лезем в настройки модуля PHP, подключаем расширение DOM

  6. jmcollin92
    Posted 2 years ago #

    Same problem for me. Any clues to resolve this issue ?


  7. jmcollin92
    Posted 2 years ago #

    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
    Followed by an (for my case) :
    sudo service httpd restart

  8. Derwood
    Posted 2 years ago #

    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.

  9. sufinawaz
    Posted 2 years ago #

    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 :)

  10. Tiago
    Posted 2 years ago #

    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 );

    $xml = simplexml_load_file($file);


  11. drmikegreen
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress Importer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic