Support » Plugin: WordPress Importer » Fatal error: Class 'DOMDocument' not found

Viewing 10 replies - 1 through 10 (of 10 total)
  • Well, line 61 of the file you listed is this:

    $dom = new DOMDocument;

    What version of PHP are you using?

    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 ;

    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.

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

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


    The solution is there :
    Followed by an (for my case) :
    sudo service httpd restart

    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.



    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 🙂

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


    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.