List of content you will read in this article:
If you are working with WordPress, you must have come across the most painful of all errors. One of them is a 500 internal error; will leave the site offline and unavailable to users. For every website owner, this error is a nightmare as it will make you lose your visitors and customers. Not only this, it will ruin the image for your brand and other competitors will gain an advantage in the market. There are other similar errors occurring, but 500 internal is the worst and can take many workarounds to get back online.
In this article, we will walk you through this dreaded error, what are its causes, different forms of this error, and finally, how you can fix it with various workarounds.
What are 500 Internal Server Errors?
Whenever you visit a website via your web browser, it sends a request to the server that is hosting the website. Within that server, your request will be processed and the response will be sent back to the requested device carrying an HTTP header. This HTTP header carries some important information that includes the HTTP status code notifying you of the request status. If that status code is 200, then your request has been processed successfully, however, if the code is 500, it means something is wrong and you have to troubleshoot it.
There are various types of this 500 error that includes 500, 501, 502, and many more. Different status codes denote different types of errors that cause your request to fail. The image shown below is an example of what your screen will look like when you come across the 500 internal server errors.
What Causes 500 Internal Server Errors?
There might not be just a single reason that makes your requests fail and results in 500 internal server errors. Any of the following can be the reasons that may cause this error.
- Due to improper browser cache.
- If you have provided incorrect database login credentials.
- In the case of a corrupt database.
- If WordPress files got corrupted while installing WordPress.
- If you are facing a problem with the connection to your database server.
- If you have corrupted WordPress core files.
- Incorrect .htaccess file present on the server and limited PHP memory limit.
- Compatibility issue with third-party installed plugins and themes.
- Improper permission and access for the file and folder on the server.
Variations of 500 Internal Server Error
The variations in 500 internal server errors may depend on the type of web browser and the operating system you are using. Regardless, all variations point to the same thing. We have mentioned below some of the variations of 500 internal server errors.
- “500 Internal Server Error”
- “HTTP 500”
- “Internal Server Error”
- “HTTP 500 – Internal Server Error”
- “500 Error”
- “HTTP Error 500”
- “500 – Internal Server Error”
- “500 Internal Server Error. Sorry, something went wrong.”
- “500. That’s an error. There was an error. Please try again later. That’s all we know.”
- “The website cannot display the page – HTTP 500.”
- “Is currently unable to handle this request. HTTP ERROR 500.”
How to Fix the 500 Internal Server Error
This error can occur due to various reasons, but sometimes you are not sure from where to even start troubleshooting for this error. We have mentioned some of the common fixes that have worked every time we have come across this error. The source of the error may be either the user’s mistake or it can be server-related. Thus, we have mentioned solutions from both perspectives.
1. Try reloading the page
One of the easiest ways of resolving this error and is commonly tried by everyone within their first attempt. Retrying to load your website again could work most of the time. You can use F5 or Ctrl+F5 to reloading the webpage. Apart from this, you can even try to run your website via different web browsers and it might also work.
Also, you can even try to put your website name at the link downforeveryoneorjustme.com, where you can check if your website is down or if any issue is going on from your side. This site will help you to get the status code for your website and if it is 500, then we can carry out other methods
2. Turn on debugging mode for your WordPress
To get a better insight into the error, it is better that you enable the debugging mode. It might not resolve the issue but you will get an idea of what is causing the error. You can make changes to your wp-config.php file to turn on the debugging mode. After opening the file, you can look for the WP_DEBUG parameter in the file. You need to set its value to true. After making the changes to the file, you can save it. Then try to reload your website and check if you see any changes.
This solution may have resolved your server error but if you still see the error then you may proceed with another solution mentioned below. Do, however, make sure you keep the debugging mode open for future use.
3. Error while connecting to a database
An improper connection to the database can also lead to seeing the 500 internal server error. If you use different browsers, you may see different error messages, all pointing to the same thing. In the below image, you can see what an error will look like while there is a database connection failure. It is a blank page as no data is being retrieved. It will crash your website and prevent you from accessing the WordPress dashboard.
There are a few reasons for this error to occur, we have mentioned some of them below.
- It may be a possibility that you have provided the wrong database credentials.
- Maybe your WordPress database is corrupted due to consistently adding and revoking themes, plugins, and other components. This can be caused due to missing tables or deletion of some information by mistake.
- It might be possible that some of the installed WordPress files are corrupted.
- Maybe the connection to the database server is not working properly. It may be caused due to overload of incoming traffic or a shortage of resources for processing those requests.
4. Check your plugins and themes
If you are considering installing themes and plugins from third parties, then there is a major chance of getting 500 internal server errors. Sometimes the error will immediately occur after the installation or while running their updates. Thus, it is recommended that you choose the staging environment for updating any components.
One of the methods is to deactivate all the installed plugins, however, you may lose most of the data due to this. If you are having an admin account, then you can deactivate your plugins easily using bulk action as shown below.
To find the actual reason, you now have to start installing each deactivated plugin one by one and check what is causing your website to fail. You need to reload your website after every plugin installation and check if you get the 500 error or not.
In case if you do not have an admin account, then you can FTP to the WordPress server and rename the Plugins folder with something else. After that, you can test each plugin easily. Then rename them back. Before installing make sure you are using the updated version of the plugins and themes. Also, after installation keep them updated with the latest version to avoid errors.
5. Reinstall WordPress Core
There could be a chance that you have installed the corrupted version of WordPress files. You can easily upload the files again without impacting the workings of any plugin and themes.
6. Permissions Error
If you are having permission issues for accessing any file on the server, it may also result in 500 internal server errors. You can follow the below permissions to access files and folders on the WordPress server.
- All WordPress files present on the server should be 644 or 640.
- All WordPress directories that are present on the server should have permission 755 or 750.
- No WordPress directories that are present on the server should ever be given permission like 777, even upload directories.
- Hardening: you can set permissions for the wp-config.php to 440 or 400 to prevent other users on the server from accessing it in any way.
You can also choose the FTP option to access the files and folders present on the WordPress server. Also, you can get help from the WordPress host support team providing you GREP file permission to check if all files are set up correctly.
7. PHP Memory Limit
If you have exhausted your PHP memory limit, it will result in 500 internal server errors on your server. You can resolve this by increasing the PHP limit for your server. You can follow the below-shown steps for increasing the PHP limit.
If you are using cPanel on a host, it allows you to change the PHP limit from the UI. You can check the “Under Software” option and click on “Select PHP Version.”
You can then look for the “switch to PHP options” as shown in the following image and click it.
You will see the below screen mentioning the PHP memory limit. You can change it accordingly.
8. Problem with Your .htaccess File
If you are running your WordPress host on an Apache server, there may be a possibility of causing the 500 error due to the .htaccess file, which may be corrupted. You can follow the below-shown steps to recreate this file from scratch.
First, you need to log in to your WordPress server via FTP or SSH with the right credentials and rename the old .htaccess file as shown below.
Due to the 500 error, you might not be able to access your admin rights, so you need to create a .htaccess file and copy the following content in that file. Lastly, upload it to the server.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
9. Contacting Your Host
If you have tried all the above-mentioned solutions to resolve the 500 internal server errors and none of them have worked, you might need to contact the host, which will help you in troubleshooting the situation and help you with the root cause so that you can be aware of it for the future.
Conclusion
Having an error or outage while accessing the website is the most painful thing for a website owner. One of the many WordPress errors, the 500 internal server error is one of the most commonly occurring errors in WordPress that will require some work around. We have mentioned various commonly implemented solutions for fixing 500 internal server errors.