[WordPress] Undefined function simplexml_load_file()
by Riley MacDonald, November 12, 2017

While installing a WordPress plugin on my staging server (Ubuntu Server 16.04) I experienced a white screen of death in my admin section after enabling it. No error, just a white screen. The front end of WordPress was still being displayed. Here’s how I resolved the issue:

Enable Debugging
I started by enabling debugging in wp-config.php (located in the root of the wordpress installation). Since this is just a staging server I can leave this enabled (don’t leave it enabled on production). I enabled it by setting WP_DEBUG to true:

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', true);

Reload the Admin Page
Now the error causing the white screen of death should be displayed. My error was undefined function simplexml_load_file() located in the plugin I was enabling. After some investigation I found that my staging server was missing the PHP package php7.0-xml.

Install the missing package
I installed the missing package and restarted the apache2 service:

# install the missing package
sudo apt-get install php7.0-xml
 
# restart the apache2 service
sudo systemctl restart apache2.service

Summary
Success, I’m able to load the admin section of WordPress again.

Open the comment form

Leave a comment:

Comments will be reviewed before they are posted.

User Comments:

Be the first to leave a comment on this post!