How to Fix the 3 most common WordPress technical errors

Photo by Rob Schreckhise on Unsplash

Solve the most common WordPress technical errors. Here are the fixes for the white screen of death, error establishing database connection and 500 internal server error problems.

Key Takeaway

You'll get the most direct solutions for these commonly-encountered errors when working with WordPress:

  • Internal Server (500) error
  • Error establishing database connection
  • White screen of death

don't panic

Photo by Jim Linwood via Flickr

Let me guess.

There you were, just about to check how wonderful your site looked after that little code change you'd just made. 

Your browser started loading the page.  

It's just about to come up.

And here it is and ... you get a ... wait.  Wait.  

What the!?  Your lovely page is still not there.

Your browser screen is still white! What's going on!?

That would be the so-called white screen of death.

Congratulations, you've just joined the millions gone before you on this frustrating WordPress journey.

So, what, if anything, can you do about it?

It does lots of things amazingly well, but WordPress is known to have a less than stellar error handling mechanism.

In this article is the solution to the three problems below - I have never needed anything else.  If you don't find the answer in here I'll take a look for you myself!

The biggest problem with WordPress error messages

​​WordPress is justifiably famous for it's ease of use and user-friendliness.  But it's not perfect.

Like all of us, WordPress sometimes has problems communicating exactly what it wants you to know.

The main problem with these common WordPress error messages is that they are not very clear.  Let's be honest, they are downright cryptic; the team at Bletchley park would have had their work cut out for them.  

They don't really tell you anything directly useful; this is pretty standard for technical error messages.  

Just for your information, these are usually NOT error messages directly from WordPress; they appear at a point where WordPress is not working and so come from a layer below WordPress.  Thus they can't really tell us much about the problem as it relates to WordPress.

There's always a way

Of course, it's not your fault that you don't understand these errors.  When my old motorbike used to just stop in the middle of the road for no apparent reason I didn't understand it and I didn't expect to - my mechanic took care of that.

Likewise with these common WordPress technical errors.  I’ve literally spent hours on each of these problems over the years. Below are the shortcuts I now use every time they crop up again.

​​​​P.S. Need some help?

If you’re afraid of dealing with these things problems then it’s best to get someone who knows their stuff to take a look. 

We'll happily check your site for free and let you know what your next step should be.  Just send us a message.

Error #1: Internal Server (500) Error

This isn't an actual common WordPress technical error; you'll find it all over the web, on any website platform.  But it's common to come across this when developing a WordPress site.

Background/Cause

All 500 errors are server-side errors, meaning it’s a problem on the server where the website is hosted.  So, it can occur on any website. It's also a common error with WordPress and it can have many causes.

If you check the list of HTTP error codes you’ll see error 500 means “A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.” 

Not very helpful to know, is it?

WordPress runs using the PHP language.  Certain errors can generate a fatal error in PHP i.e. code execution just stops.  If your server is configured not to display error messages from PHP (which is usual), the error returned by the server will be 500.

Troubleshooting Internal Server (500) Error

To find a solution to the Internal Server Error message on a WordPress website here are the simple steps to check the problem.  Do the following in order as the most common solution comes first.

1. Check .htaccess

.htaccess is one of the more important files in your WordPress installation, being the configuration file for Apache web servers, still the most popular web server in existence.  The web server serves your website pages to a browser.  An incorrect entry in this configuration file can lead to unexpected results when viewing your website.

If you have FTP access (for instructions, see the post How to easily edit WordPress source code) or cPanel access (instructions from Siteground here) to your WordPress website, go to the root of your site (/) and rename the .htaccess file to .htaccess.old.

Reload the website in your browser (by pressing F5) - WordPress will rebuild a simple .htaccess file.  If the site now works it means you had a problem with .htaccess.

Go to your WordPress Dashboard > Settings > Permalinks and click save. This should rewrite a new .htaccess and all will be good.

2. Deactivate all plugins

A commonly suggested WordPress troubleshooting technique is to deactivate all plugins and see if that solves the problem.  To be honest I use it very, very rarely; it's messy but it can help.

The handiest way to deactivate all plugins is via FTP.  Connect to your site with an FTP client, go to the following directory

/wp-content

<yoursite.com>/wp-admin

Here you'll see a directory named plugins, among others. Rename this directory to something like plugins.old

Now log into your WorPress dashboard; WordPress won't be able to find your plugins and will simply deactivate them all. See this page at the WordPress codex for more details.

If your website now works when you view it, it means one of the plugins was to blame.  

Now you can go through the pain-staking process of re-enabling each plugin one by one, reloading the site and checking it still works.  When it stops working, the last plugin re-activated is usually the one causing the problem. (Actually, it's possible that another plugin is faulty and having conflicts with this latter one.  If this is the case, you might need some expert help.)

You can also solve this common WordPress technical error by disabling Plugins in your database but that’s tricky and risky so I won't cover it here.  Just keep in mind that someone technically adept can help you do this.

3. Change your theme

The default themes in WordPress are incredibly useful for troubleshooting theme problems.  

Even if the normal front end of your site doesn’t work, your dashboard will often continue to work.  If possible, log into your site at 

<yoursite.com>/wp-admin

and change your WordPress theme to one of the default themes like TwentySeventeen.

If you can't even log into your WordPress dashboard, use FTP to rename the current theme folder to NAME-old and see if that helps.  The themes for your site can be found at

/wp-content/themes/

If changing to a default theme solves the problem then undo any recent changes you made to your own theme.

4. Change your PHP memory limit 

PHP, the programming language that WordPress is written in. sets a limit on how much memory any of your website's scrip'ts is allowed to use.  This helps to stop scripts from eating up all available memory on the server your website runs on.

You can raise this limit via the wpconfig.php file but in my experience this doesn’t often work.  If you have a well configured server from your hosting provider this will rarely be the problem.  Still, it's a possibility worth trying.

You can edit the wpconfig.php file using FTP.  We've a post on how to do that here.

Next, paste the following code into wp-config.php right before the line that says ‘That’s all, stop editing! Happy blogging.’

define( 'WP_MEMORY_LIMIT', '256M' );

This code tells WordPress to increase the PHP memory limit to 256MB.

Once you are done, save these changes and upload the wp-config.php file back to your server.

You can also set the PHP limit in .htaccess or php.ini. Learn how to raise the limit at this page.

5. Reinstall WordPress

If all else fails you can of course reinstall WordPress either from your server or by uploading a new full version of the software via FTP.

Usually uploading the wp-admin and wp-includes folders solves the problem.

Learn more about reinstalling WordPress at this page.

Error #2: Error establishing database connection

WordPress stores your website’s dynamic information in a database running on MySQL.  Obviously that connection is essential for your site.

Background/Cause

If that crucial connection fails, you’ll likely see this error.

WordPress Database Error

Troubleshooting WordPress database connections

1. Bad configuration in wpconfig.php

Nine times out of ten, the "Error establishing a database connection" problem is caused by an incorrect setting in the WordPress setup file wp-config.php.  Use FTP to open this file.

Near the top of the file you'll see this line

// ** MySQL settings - You can get this info from your web host ** //

Check the details here are correct for your site.

/** The name of the database for WordPress */
define('DB_NAME', 'databasename');

/** MySQL database username */
define('DB_USER', 'databaseusername');

/** MySQL database password */
define('DB_PASSWORD', 'databasepassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

2. High traffic

Your users might see this error if your WordPress website is on shared hosting, which most are, and gets swarmed with a lot of traffic. In that case it's best to get on the phone or live chat with your hosting provider and get them to check the problem.

Error #3: The White screen of death

The dramatically-named WordPress "White screen of death" is named after the infamous and equally dramatically-named Windows Blue screen of death.  If you're too young to remember that one don't worry, read on ...

Background/Cause

You're most likely to come across this problem if you're changing code on your WordPress website.  It can also pop up when installing or updating any site components like plugins or themes.

WordPress White Screen of Death

The famous WordPress white screen of death (yes, there's an image there)

Like the 500 error above, there can be many causes that might take some time to track down. Still, there's always a solution.

Troubleshooting WordPress database connections

To be honest there is really only one method worth trying here - using WordPress's debugging feature.

Turn on debugging

Many articles dealing with the white screen of death will give you a list of things to try. Once you've tried all of those, then they'll tell you to switch on debugging.  

But guessing is not an efficient use of your time so let's start with the debugging option.  This is the troubleshooting step that will lead you to a solution 90% of the time.

For this you use the wpconfig.php file again. Open it via FTP and search for the following line:

define('WP_DEBUG', false);

To turn on debugging, change the false to true.

Now go to your website again in your browser.  With this setting switched on, instead of a blank screen you should get an error message.  That error message is often cryptic, yes, but it can point you to where you need to look.

Usually that error message will contain the name of the file that caused the problem.  If you see something like

/wp-content/plugins/XXXX....

in the error string then you should try disabling that plugin XXXX that's named there.

If that's not possible then search for the error with Google. This often leads you directly to the source of the problem and how to fix it.

Conclusion

Hopefully you never reach this part of the article because you found what you were looking for above.

For more about common errors I haven't covered here check out the ever-helpful WordPress Codex at https://codex.wordpress.org/Common_WordPress_Errors

If you have any other tips for dealing with these errors then let me know in the comments below.

Thanks for reading and if you found this useful hit one of the share buttons.  It would mean a lot to me and it helps others find the article.
  • by Seán
  • |
  • May 18, 2018
Click Here to Leave a Comment Below

Leave a Comment:

$(document).on('click', 'a', function(event){ event.preventDefault(); $('html, body').animate({ scrollTop: $( $.attr(this, 'href') ).offset().top }, 500); });