Have you ever browsed happily through a particular website that was doing perfectly fine, and then seconds later, it decides to turn you over on your head by spitting out a 500 internal server error? That’s uncalled for, and nobody wants that.
Or sometimes, you’re trying to access your WordPress admin panel and then come across the horrible internal server error that tells you something like this: “The server encountered an internal error or misconfiguration and was unable to complete your request.”
For those who aren’t as familiar with how to fix a slight like this, they might be racking their brains at this very moment trying to figure out what in the heck happened to their website.
But first and foremost, there is a need to understand how these internal server errors happen in WordPress, in the first place.
Why do internal server errors occur?
Internal server errors aren’t native to WordPress alone. You can encounter a 500 internal server error in any website. The common layman won’t be very familiar with generic errors like this cropping up once in a while.
There are 5 reasons why an internal server error happens in WordPress
1. Incorrect file permissions
With minimal exceptions, file permissions for WordPress along with corresponding themes and plugins should be set at 755 for folders, and 644 for files.
Setting permissions to be overly strict or too lenient may cause errors like the internal server error along with other errors.
2. Incorrect web server configuration
Web servers (whether IIS or Apache) configured with incorrect directives will cause internal server errors. Just know that web hosting support often sees it fit to blame the error on software that has been installed.
In some cases, you’ll have to get your web host to help you in diagnosing the problem and executing the proper methods to fix it.
3. Third party plugin culprits
Sometimes the reason for a 500 internal server error is a faulty plugin. What you’ll want to do is deactivate all your plugins, and after doing it, check your front end page again.
And if you find no errors barring your way, then it’s highly likely that you have plugin conflicts. You can go down the line and deactivate plugins one by one. The last plugin running that threw up an error is the likely culprit.
4. The PHP memory limit is set up too low
You can ask your web host to increase your PHP limits, or you can upload a theme through an FTP client.
5. Files with errors in code and corrupted files
Errors in file transfers to a web server can cause corruptions to crop up. Something in the process is rendering the file unusable by the server.
Perhaps the most common culprit for a 500 internal server error produced by a file is connected to the WordPress .htaccess file. If this particular file contains errors, it will likely throw a 500 internal server error in your face.
How to Fix the Internal Server Error on WordPress
The name “internal server error” can be misleading to a point. In most cases, the server (or your host) is not the main culprit. A closer look at HTTP specifications will reveal this:
“The server encountered an unexpected condition that prevented it from fulfilling the request.”
The server itself is not the problem. It’s simply come across something it can’t decipher.
What you need to do is visit the admin website at https://domainname.com/wp-admin/. If the page loads correctly and lets you log in with no issues, you can now be sure that the issue lies in your theme or your plugin.
You’re going to be looking at two situations. Either your admin login page loads or it doesn’t. There are steps you have to take for either situation.
If the Admin Log-in Page Loads Without Issues
If the admin log-in loads without issues, implement the following steps:
Step #1: Deactivate your plugins
A plugin won’t be able to cause issues if it’s disabled. So if you’re suspecting plugins as the cause of the problem, navigate to the plugins section and proceed to disable them all. Rest assured that they’ll keep all their saved data, but their codes won’t be running.
If the website is now doing fine, you must proceed to enable each plugin one at a time. While doing so, check for 500 internal server errors after enabling plugins. When you find the culprit for the dreaded errors, you can then decide what you want to do with it.
But if, upon disabling all the plugins, and the site still fails to load, proceed to the next step.
Step #2: Change over to a default theme
If it’s not the plugins, then it’s time to check and see if the theme is the problem. Switch to a default WordPress theme — specifically Twenty Sixteen (WordPress’ latest default theme). If this solves your problem, it’s time to re-enable all the plugins, and work on finding the issues in your theme’s code.
If the Admin Log-in Page Won’t Load
If the admin log-in won’t load and is facing problems, you can implement the following steps:
Step #1: Increase the PHP Memory Limit
Exhausting your site’s memory limit may result in a 500 internal server error. Web servers are in need of memory to effectively run multiple applications.
And server administrations are responsible for allocating specific memory sizes to different applications; that includes PHP.
As a default, WordPress immediately tries to increase PHP memory limit if it’s less than 64MB. But in most cases, 64MB is not high enough.
Also, remember that your server or your account may have a set amount of memory delegate to it, and maybe you won’t be able to increase the PHP memory limit beyond that. WPBeginner details that process, in case you’re looking to incorporate that.
Increasing the memory, or making use of the default 64MB increase only fixes it temporarily. They are often a sign of a poorly coded plugin or a malfunctioning theme.
But if increasing the PHP memory limit still didn’t solve your problem, let’s proceed to do more troubleshooting.
Step #2: Fix some .htaccess issues
Your .htaccess file is a configuration file for the Apache Server. It enables relatively advanced functionalities.
If you’ve been doing codes for years, then you know how sensitive an area this is. In typing, a strong level of caution must be in place.
A single mistake in encoding, a forgotten space, or an unclosed quote can easily result in your site throwing up a 500 internal server error.
The .htaccess file can be found in the root WordPress folder. Open it and check for errors (even more so if you’ve recently made changes to it). Expert coders would also recommend creating a backup file named backup .htaccess. You can delete the original .htaccess file after and see if the website goes back online.
And if your site comes back up, the issue is with your .htaccess file. Review the file line by line and see where your site goes down.
If you found an offending line, make sure it doesn’t contain unnecessary texts. If you can’t find the offensive line of code, simply delete the line that you suspect the error is originating from.
Step #3: Re-upload some core files
It’s extremely rare, but there are times when you chance upon a corrupted file within WordPress’ core itself. It’s not something to panic about. It’s just that something might have gone wrong when the server was in the process of copying required files.
Don’t worry. It won’t remove any of your information. Simply visit WordPress.org and redownload your WordPress software.
Step #4 Consult your hosting provider
If all manner of troubleshooting fails, it’s time to contact your web hosting support team. They can check the server logs for you, and hopefully locate the root source of the 500 internal server error.
Final Thoughts on Fixing the 500 Internal Server Error
500 internal server errors are vague, and more often than not, resolving them can be difficult and takes time. But following the steps detailed on top can prove to be useful, and may help you figure out exactly what is going on with your website.