How to Fix the 500 Internal Server Error
Internal Server Error is one of the common errors that are seen on WordPress Sites. Even though it is common error, it never has a straightforward solution, requiring a lot of troubleshooting that can eat up your time and patience. Here in this blog, I would share some of the fix, that could help you out to solve this error.
500 Internal Server Error Variations
Due to the various web servers, operating systems, and browsers, a 500 internal server error can present itself in a number of different ways. But they are all communicating the same thing. Below are just a couple of the many different variations you might see on the web:
- 500 Internal Server Error
- HTTP 500 Error
- Internal Server Error
- HTTP 500 – Internal Server Error
- 500 Error
- 500 Internal Server Error. Sorry something went wrong.
- 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.
- A blank white screen.
Bigger brands might even have their own creative custom 500 internal server error messages as below:
Internal server error is not specific to WordPress, and it can happen with anything else running on your server as well. Below mentioned are some of the common cause which leads to internal server error.
- Check error_log
- Corrupted .htaccess file
- Check if your files and folders have the correct file permissions
- PHP memory limit
- Switch PHP versions
- WordPress plugin
- WordPress theme
- Re-uploading Core Files
- Debugging Your WordPress Website
- Contacting Host
Since these solutions require making a lot of changes in your site’s root directory. It’s highly recommended you backup your site prior to trying any of these solutions in case something goes wrong.
Checking Error_log
Consulting your server’s error logs is a helpful way to diagnose exactly what’s causing the problem. If your host uses cPanel, you can view error logs by going to your cPanel dashboard and clicking on Error Log:
Unfortunately, as you can see from the image below, these error logs aren’t always the most user-friendly documents to read:
If nothing obvious sticks out in the error logs, you can consult your host’s support for help understanding what the issue might be.
Checking for Corrupted .htaccess File
You can check by renaming your existing .htaccess file to something like .htaccess.bak. To rename the .htaccess file, you will need to login to your site using cPanel/FTP or need Shell access. Once you are in, the .htaccess file will be located in the same directory where you will see folders like wp-content, wp-admin, and wp-includes.
I’m going to show you the process using File Manager because it’s the simplest for most users. But the core principles are the same no matter which method you use.
You can access File Manager right from the cPanel dashboard:
Once you open File Manager, look for the .htaccess file in the root of your site.
Right-click it, and choose Rename:
Once you have renamed the .htaccess file, try loading your site to see if this solved the problem.
If the problem is solved, don’t forget to make sure that you go to Settings » Permalinks and click the save button. This will generate a new .htaccess file for you with proper rewrite rules to ensure that your pages do not return a 404.
Check if your files and folders have the correct file permissions
Make sure that all files and folders have the correct permissions.
Files must have 644 while folder takes 755.
If you have shell access you can try the below commands to fix the permmission issues in an easy way.
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
PHP memory limit
Sometimes this error can happen if you are exhausting your PHP memory limit. You need to increase your PHP memory limit in WordPress and refresh your site to test whether or not this is causing your 500 internal server error.
Log into cPanel, open your Document root directory, and locate your wp-config.php file.
Right-click on the file, and select Download to download it to your computer. Open the file in your preferred text editor, and add this bit of code under the opening PHP tag:
define(‘WP_MEMORY_LIMIT’, ’64M’);
Save the file, and re-upload it to your root directory, overwriting the original file. Refresh your site. If you still see the error, you are not having PHP memory limit issues. Remove the above code from the wp-config.php file on your computer, save it, and re-upload it to your root directory.
You can also use custom php.ini to increase php memory limit by following the below steps.
- Create a blank text file called php.ini in the document root.
- Paste this code there: memory_limit = 64M
- Save the file
Switch PHP versions
Sometimes the plugins and scripts you use require a certain or the latest version of PHP to be installed on your server. If you’re using the incorrect version, this could be the cause of the internal server error.
WordPress Plugin Issues
If you’re able to access the WordPress admin area, disable all plugins and see if it is fixed the error, then you know it is one of the plugins that is causing the error. Then activate your plugins one by one. Refresh your site after each activation. If the error appears, it was likely caused by the plugin you activated prior to refreshing. Delete the plugin and find a replacement if its function is important for your site. If you don’t feel you can replace the plugin, contact the developer directly.
How to deactivate plugins if you can’t access your dashboard:
With the internal server error in WordPress, you are most likely not able to access the WordPress admin dashboard. In this case, you’ll need to take a slightly different approach and deactivate plugins using FTP.
- Connect to your site via FTP or File Manager.
- Navigate to the /wp-content/
- Rename the pluginsfolder to something like
Once you rename the folder, all of your current plugins will be deactivated.
Now try opening your WordPress dashboard, and if you are able to access it, then the issue is with one of the plugin.
If it is working, rename the plugin_old to original name and enter into plugin folder. Try deactivating each plugin by renaming and find the incompactible plugin and remove that.
WordPress Theme Issues
If the above couldn’t resolve the issue, then its time to check your site theme. If you are using any custom theme, kindly deactivate it and use wordpress basic theme on the site and check. If it works, you can confirm that the issue is with the theme. Try reinstalling the corrupted theme and sit relaxed.
Re-uploading Core Files
If the theme option didn’t fix the internal server error, then it is worth re-uploading the wp-admin and wp-includes folder from a fresh WordPress install. Re-uploading the wp-admin and wp-includes folder from a fresh WordPress install, will not remove any of your information, but it may solve the problem in case any file was corrupted.
- First you will need to visit the WordPress.org website and click on the Download button.
- Unpack the zip file that you downloaded.
- Deactivate plugins.
- Delete the old wp-includes and wp-admin directories on your web host (through your FTP/cPanel or shell access).
- Using FTP/cPanel filemanager or your shell access, upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
- Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
- Upload all new loose files from the root directory of the new version to your existing wordpress root directory.
NOTE : You should replace all the old WordPress files with the new ones in the wp-includes and wp-admin directories and sub-directories, and in the root directory (such as index.php, wp-login.php and so on). Don’t worry – your wp-config.php will be safe.
Be careful when you come to copying the wp-content directory. You should make sure that you only copy the files from inside this directory, rather than replacing your entire wp-content directory. This is where your themes and plugins live, so you will want to keep them. If you have customized the default or classic themes without renaming them, make sure not to overwrite those files, otherwise you will lose your changes. (Though you might want to compare them for new features or fixes.)
Lastly you should take a look at the wp-config-sample.php file, to see if any new settings have been introduced that you might want to add to your own wp-config.php.
Debugging Your WordPress Website
You can use WordPress’ built-in debugging feature to figure out what’s causing this error. Pasting a bit of code into your site’s wp-config.php file enables debugging on your site. Any errors found are recorded in a file in your directory.
NOTE: You must insert this BEFORE /* That’s all, stop editing! Happy blogging. */ in the wp-config.php file.
- Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed.
- WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/directory.
- WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not.
- SCRIPT_DEBUG is a related constant that will force WordPress to use the “dev” versions of core CSS and JavaScript files rather than the minified versions that are normally loaded.
Contacting Your Host
If you’ve gone through all of these steps and still cannot find a solution, your host may have it. It is, however, important that you go through these steps to ensure the issue is not occurring in your root directory.
The 500 internal server error is a frustrating issue as it doesn’t always have a clear cause or a clear solution. It requires a lot of troubleshooting, as you’ve learned, but I hope these steps have at least made the task a little less irritating.