The error 500 – Internal Server Error is a very common issue in webservers. It can be caused by several reasons. In this article, we will explore the possible causes and present alternatives on how to fix 500 internal server error. This error is similar to the 404.
Article contents:
1.0 The causes of the 500 error
2.0 How to fix 500 internal server error in WordPress sites
2.1 Solution 1 – Reset the .htaccess via WordPress
2.2 Solution 2 – Manually reset the .htacess file
2.3 Solution 3 – Update and deactivate plugins
2.4 Solution 4 – Try to change your theme
3.0 How to fix the 500 error in non-Wordpress sites
3.1 Solution 5 – Check your .htaccess syntax
3.2 Solution 6 – Rename your .htaccess file
3.3 Solution 7 – Enable error displaying in PHP
3.4 Solution 8 – Check your error logs
The causes of the HTTP error 500
Whenever a web server delivers a web page to the client, it throws HTTP status codes. Each status code means the result of such a request. For example, the HTTP status 200 means success: when a page was delivered and shown correctly.
For example, the status code 404, means the error Page not found. Then, the HTTP error 500 means an internal server error message. Such error 500 is one of the widest HTTP errors and may have several possible causes. In this article, we will approach the most common causes. And of course, show the fixes for them.
Such specific error is most commonly caused by server side issues. Even one single PHP script syntax errors, file permissions or htaccess misconfiguration can cause such error. This error doesn’t depend on the operating system – both Windows and Linux based web servers will present such HTTP status code. Even external resources can cause the 500 error.
How to fix 500 internal server error in WordPress sites
Most of the problems generating the 500 server error in WordPress are caused by issues in the .htaccess file. Some of the problems are caused by plugins or templates. To troubleshoot this issue, we will, first of all, reset the .htaccess file. Then, if it persists, we will look into a problem with plugins or the templates.
The .htaccess file is a common file that defines redirections and behaviours in the web server. cPanel has a default .htaccess file, which is placed inside the root folder of your WordPress blog. For example, our blog is on the root folder of the website. So, the .htaccess file is located inside public_html.
Most of the error 500 issues in WordPress are caused by plugins or a misconfiguration in the .htaccess file. We suggest resetting this file.
There are two methods:
Solution 1: Reset the .htaccess via WordPress admin panel
First of all, open the Permalinks section. It’s located under Settings.
Whenever you make changes to your permalinks structure, WordPress automatically resets the .htaccess file. Please note that resetting this configuration may affect your SEO. Now, we recommend changing the option on this screen. After that, click Save. This way, WordPress will reset your .htaccess file and the error 500 may be solved.
Solution 2: Manually reset the .htaccess file
If you use WordPress, you may want to reset your .htaccess to default. Make sure to copy and keep a backup of your old/current .htacess file.
This is how the default .htaccess file of WordPress looks like. Just empty the .htaccess and. Then, copy and paste this content to your .htaccess:
# 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
Solution 3: Solve problems in plugins
To help our customers on how to fix 500 internal server error, we have to troubleshoot and try to find the cause of the problem. It’s very common to have plugins or templates generating this issue.
First of all, click on the Installed Plugins option. It’s located under Plugins.
Then, you have to try to update each plugin with such a message. To update, simply click Update now. If after updating every plugin, you still have the 500 internal server error, we recommend deactivating the plugins one by one until you find the problematic one. Simply click on Deactivate.
Solution 4: Change the theme
Sometimes a changed was applied to the theme, and some PHP file may be damaged. To fix the 500 server error, there is another possibility: changing the WordPress theme. To do that, simply go to Themes under the Appearance menu.
Then, locate a different theme, and click Activate.
How to fix this error in non-Wordpress sites
There is a vast possibility of causes of the 500 error in sites that don’t use WordPress. In this section, we will show the most common causes and solutions on how to fix the 500 internal server error problem. Most of the times, this problem is caused by issues in your .htaccess file. This file is always located in your root folder (public_html).
Solution 6 – Check the .htaccess file syntax
Simply edit this .htaccess file, and look for any misconfiguration. We recommend this .htaccess tester. This way, you can copy and paste the contents of your current .htaccess file. This site shows which lines have a bad syntax. It will highlight in red all the problematic lines, for you to fix them.
Solution 7: rename the .htaccess file
You can simply rename this file. It will deactivate it in the server. Just change its name to something like .htacess-old, for example. This way you can see the behaviour of your site without it.
Solution 8: enable error displaying in PHP
By default, PHP shows the 500 errors this way. There is an option that you can enable, in order to force PHP to show on screen the exact error message.
Simply add these lines to the beginning of your PHP file, inside the <?php and ?> tags.
error_reporting(E_ALL); ini_set('display_errors', 'On');
Now you can see the exact error message, in order to fix the 500 internal server error issue:
Solution 9: Check the error logs in the server
Lastly, if none of the previous solutions worked, we recommend checking the error logs. They will probably show you the reason of the 500 internal server error. In your cPanel control panel, open the Errors option, which is located under Metrics.
Then, all the error messages will be shown.
Conclusion
The 500 internal server error is one of the widest problems in web hosting. There are several possibilities and causes for that. We have helped many hosting customers on how to fix 500 internal server error issue so far. As we explained, there are easy and quick fixes and the toughest ones.
The last possibility is to check the log files if none of the solutions worked for you. Then, after checking the error logs, you can simply search in Google for the exact error message. For sure there will be pages showing their fixes. Least but not last, you may want to check this other article about how to use customized error pages in your site.