How to fix internal server error WordPress? Here is below given the best answer to the question with an example.
The internal server error is one of the common errors in WordPress. If you are a WordPress user you might have come across this error several times. This error doesn’t give any other information. Thus, many beginners in WordPress find it difficult to fix this error. Through this article, we will guide you through how to fix internal server errors in WordPress.
Reasons for Internal server error in WordPress
The internal server error is common with any web for running on a web server. It is not specific to the WordPress server. Many of them find it difficult to fix this internal server error since it doesn’t give any information about the error.
The main cause for WordPress internal server error is some theme or plugin functions. Another possibility for this error is a corrupted .htaccess file and PHP memory limit.
Now, let us see how to troubleshoot this internal server error in WordPress.
Check for the corrupt .htaccess file
The .htaccess file is a configuration file read by the server. Doing this is going to override your server configuration settings. It can also be used for, cache control, website optimization, authorization, and URL rewriting. In WordPress, the .htaccess file is used most commonly for rewriting URLs, making them cleaner, and more readable by humans and search engines.
Checking for the corrupt .htaccess file is the first step you have to do while troubleshooting the WordPress internal server error. In order to do that, rename your main .htaccess file to something like .htaccess old. To rename the file. Then you will need to log in using FTP or the file manager app from your hosting accounts cPanel dashboard.
After renaming the .htaccess file, visit your site and see if the problem is solved. If it is not saved, before you move on to other ways. Then make sure that you go to the Settings » Permalinks page in the WordPress admin area and click the save button without making any changes. This will generate a new .htaccess file for you with proper rewrite rules to ensure that your post pages do not return a 404 error.
Checking for the corrupt .htaccess file may not always solve your issue. You can also try some other methods.
Increasing PHP memory limit
Sometimes the internal error can be caused due to less PHP memory limit. In order to increase the PHP memory limit in WordPress, First, edit the wp-config.php file on your WordPress site. It is located in the WP root folder and you will need to use an FTP client or file manager in your web hosting control panel.
If this does not work for you, then your web hosting provider does not allow you to increase your PHP memory limit manually.
If you are seeing the internal server error only when you try to login to your WordPress admin or upload an image in your wp-admin, then you should increase the memory limit by following these steps:
Create a blank text file called php.ini
Paste this code in there: memory=64MB
Save the file
Upload it into your /wp-admin/ folder using FTP
If increasing the PHP memory limit fixed the problem for you. Then your issue is not solved permanently. You have to find the cause of exhausting your memory. This could be for many reasons such as a poorly coded plugin or a theme function. We recommend you get the server logs from your WordPress web hosting provider that can help you find the exact cause of exhausting your memory limit.
When increasing the PHP memory limit doesn’t solve your issue, then you have to do some more troubleshooting.
If checking for the corrupt .htaccess file and increasing the PHP memory limit doesn’t solve your problem. Then the issue might be something related to a specific plugin or a conflict between the combination of plugins that are not working fine with each other.
For checking this you can deactivate all the plugins at once. If disabling all the plugins will resolve the error, then it confirms that one of the plugins is causing the error. Now activate those plugins one by one to find the plugin which is causing the internal error. Once you find the plugin, get rid of it and report the error to the plugin author
Re-uploading WP core files
Re-uploading the WP core files like wp-admin and wp-includes folders from a fresh WordPress install may help you in fixing the WordPress internal server error. Doing this won’t remove any of your information, but may fix the issue in case of any file was corrupted.
In order to get the WordPress core folders, download the WordPress zip file to your computer. Now extract the zip file and you will find a WordPress folder inside it.
Now connect to your WordPress website using an FTP client. Once connected go to the root folder of your website. It is the folder that has wp-admin, wp-includes, wp-content folders inside it.
In the left column open the WordPress folder on your computer. Select the folders such as wp-includes and wp-admin and then right-click and select ‘Upload’.
FTP client will now transfer those folders to your server. It will ask you whether you would like to overwrite the files. Select ‘Overwrite’ and then select ‘Always use this action. The FTP client will now replace your old WordPress files with newer fresh copies. If your WordPress files were corrupted, then this step will fix the internal server error for you.
Consult your hosting provider
If all the above methods fail to solve your problem, then you can contact your hosting provider and they will be able to check your server logs and find the root cause of the error.