WordPress Ghost plugin returns 500 error

I’m getting a 500 Error while attempting to convert a WordPress blog to Ghost. I’ve followed the instructions outlined in Ghosts’s Migrating from WordPress to Ghost article. I am using a self-hosted WordPress 4.9.7 installation on Ubuntu 16.04, served with nginx.

The 500 error returns immediately (not a timeout issue). I get the following stack trace in my nginx error log:

2018/07/06 15:46:59 [error] 2656#2656: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'DOMDocument' not found in /var/www/wordpress/wp-content/plugins/ghost/lib/html-to-markdown/HTML-To-Markdown.php:79
Stack trace:
#0 /var/www/wordpress/wp-content/plugins/ghost/lib/html-to-markdown/HTML-To-Markdown.php(50): HTML_To_Markdown->convert('<p>This is the ...')
#1 /var/www/wordpress/wp-content/plugins/ghost/class-ghost.php(312): HTML_To_Markdown->__construct('<p>This is the ...')
#2 /var/www/wordpress/wp-content/plugins/ghost/class-ghost.php(437): Ghost->populate_posts()
#3 /var/www/wordpress/wp-content/plugins/ghost/class-ghost.php(525): Ghost->populate_data()
#4 /var/www/wordpress/wp-includes/class-wp-hook.php(286): Ghost->download_file('')
#5 /var/www/wordpress/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/wordpress/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#7 /var/www/wordpress/wp-settings.php(450): do_action('init')
#8 /var/www/wordpress/wp-config.php(92): require_once('/var/www/wordpr...'" while reading response header from upstream, client:, server: wordpress.nikovacevic.io, request: "GET /wp-admin/tools.php?ghostexport=true&submit=Download+Ghost+File HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "wordpress.nikovacevic.io"

I’m hoping someone can help me figure out why this DOMDocument class is missing and how to fix it.

Solved! On Ubuntu 16.04, php-xml may not be enabled by default. You simply have to install it, using

sudo apt-get install php-xml

The HTML To Markdown for PHP: Dependencies documentation spells this out.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.