WordPress

Fixing WordPress Errors: White Screen, 500 and Database Connection

Seeing a blank page, an Internal Server Error or Error establishing a database connection? Here is how to diagnose and fix the most common WordPress errors.

By Zebra Hosting Cloud

WordPress errors look frightening, but most have a small number of causes and a logical path to a fix. The key is to work calmly and change one thing at a time. This guide covers three of the most common problems: the blank white screen, the 500 Internal Server Error and the database connection error. Before you start, make a backup if you can reach your files.

Start by finding the real error

Generic error pages hide the cause. Your first job is to see the actual message. There are two main sources.

The server error log

Your hosting control panel provides access to logs. In Plesk, you can view the website's error log for the domain. Look for the most recent entries around the time you saw the problem. They often name the exact file and line that failed.

WordPress debug mode

Enable logging in wp-config.php before the line that says to stop editing:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Errors are then written to wp-content/debug.log without showing on screen to visitors. Switch debugging off again when you have finished.

The white screen of death

A completely blank page usually means a PHP fatal error with display switched off. Common causes:

  • A plugin or theme update that is incompatible with your PHP or WordPress version.
  • A PHP memory limit that is too low.
  • A syntax error in a code snippet you added to the theme.
  • A corrupted file after an interrupted update.

Fix steps

  1. Check the debug log or error log for the file path in the error.
  2. If a plugin is named, rename its folder in wp-content/plugins using the file manager or SFTP. WordPress then deactivates it.
  3. If the theme is at fault, rename the active theme folder; WordPress falls back to a default theme if one is installed.
  4. If the message mentions memory, raise the PHP memory limit in the hosting panel, or add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php if your host allows it.
  5. If you recently edited code, undo that change.

WordPress also has a recovery mode feature that emails the administrator a special link when a fatal error occurs, allowing access to deactivate the culprit. Check the admin email inbox.

500 Internal Server Error

A 500 error is a general server-side failure. WordPress is not always at fault. Typical causes include:

  • A broken .htaccess file.
  • A plugin or theme fatal error.
  • Incorrect file permissions or ownership.
  • A PHP version or setting that conflicts with the code.
  • The account hitting resource limits.

Fix steps

  1. Read the server error log first; it usually points straight at the cause.
  2. Rename .htaccess to something like .htaccess-old and reload. If the site returns, regenerate the file by saving Settings, Permalinks in the dashboard.
  3. Disable plugins by renaming the plugins folder, then re-enable them one by one.
  4. Check that folders are not world-writable and that file ownership matches your account.
  5. Switch PHP versions in the control panel to see whether the problem is version-related.
  6. Ask your host whether you are hitting limits on processes or memory.

Error establishing a database connection

This message means WordPress cannot reach or log in to the database. It is not always a hack. Check the usual suspects:

  • Wrong credentials in wp-config.php: the database name, user, password or host (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST). A recent migration or password change is a typical trigger.
  • The database server is down or overloaded. Ask your host, or check whether other sites on the account also fail.
  • The database user lost its permissions, or the database was deleted.
  • Corrupted tables. WordPress has a repair option you can enable temporarily with define( 'WP_ALLOW_REPAIR', true );. Remove it again after use, since the repair page does not require login.

Fix steps

  1. Open the database tool in your control panel and confirm the database and user exist.
  2. Compare the details with those in wp-config.php.
  3. Try logging in to the database with the same credentials in the panel's database tool.
  4. If everything matches and the error persists, contact your host about database server status.

Other related errors

SymptomLikely cause
Stuck on maintenance modeInterrupted update; delete the .maintenance file in the site root
Admin loop back to loginCookie or URL settings, caching or a plugin conflict
Upload failsPHP upload limits or folder permissions
404 on all inner pagesPermalink or .htaccess rules; re-save permalinks

Prevent repeat problems

  • Update on staging first, and back up before changes.
  • Keep PHP versions in line with plugin compatibility.
  • Remove unused plugins and themes.
  • Keep the error log readable and check it when something odd happens.
  • Give your site enough PHP memory for the plugins it runs.

Help when you need it

If the cause stays unclear, ask your host. With our WordPress hosting, support is available in 17 languages, and the knowledgebase has step-by-step guides for Plesk logs and PHP settings. If a site keeps failing on its current host, our team can migrate it for free.