WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Carlos
    Member
    Posted 1 year ago #

    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/

  2. Jason Lemahieu (MadtownLems)
    Member
    Posted 1 year ago #

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

    $dom = new DOMDocument;

    What version of PHP are you using?

  3. davidlowry
    Member
    Posted 1 year 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. Jason Lemahieu (MadtownLems)
    Member
    Posted 1 year ago #

    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
    Member
    Posted 1 year ago #

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

  6. jmcollin92
    Member
    Posted 1 year ago #

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

    JM.

  7. jmcollin92
    Member
    Posted 1 year 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
    Member
    Posted 11 months 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
    Member
    Posted 10 months 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. taotiago
    Member
    Posted 7 months 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 );

    For:
    $xml = simplexml_load_file($file);

    :)

  11. drmikegreen
    Member
    Posted 7 months 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

About this Topic