6 Best Ways To Fix Internal Server Error 500 on WordPress Based Websites
Do you see 500 internal server error when you open your WordPress website? If yes, this article is for you. After reading this post, you will know how to fix internal server error 500 on wordpress sites and what are the reasons behind this error?
How To Fix Internal Server Error 500 on WordPress Sites?
People who do not know the solution really panic because the error itself gives no clue. But there is nothing to worry about. We will guide you. No matter, your website is hosted on SiteGround Web Hosting or any other hosting provider. It is not true that internal server error is specific to WordPress. It can happen with any website. It does not reveal anything to developer because of its generic nature.
Let’s first discuss what WordPress error is? As the name depicts this error occurs on server. It is an application side issue that can occur on your web server. When you enter a specific URL, you are requesting the server to show you that page. Due to some reason, server is unable to do it. This is called internal server error.
Backing up your website data is always a good practice. Server is managed by humans and is prone to errors. These errors can be severe and sometimes you might lose all data of your website. So you must backup website data on your server. If you face this error right after you made some change, just restore the backup you created before making changes. Now let’s talk in detail about the main reasons behind Internal Server 500. For different reasons, we would use different methods for solving the problem.
1. When .htaccess File Gets Corrupted – Internal Server Error 500 Occurs
.htaccess basically stands for short for Hypertext Access. This is a is a configuration file used by your web server to control the directory it lives in. In our case it is WordPress directory. All sub-directories under that directory also falls in. Most of the time .htaccess file causes the problem by getting corrupted. This is the key file in any web application based on PHP. We will rename .htaccess file to check if it is the reason of problem. Just login to your wordpress directory using ftp. Usually, wordpress directory site is Home or Public_html directory. Locate your .htaccess file and rename it to .htaccess_old.
Now reload the site, to check if it is working or not. If the error is gone then let’s go to the next step. Now you will have to recreate .htaccess file. Go to wordpress admin dashboard and navigate to settings. Click on the permalink in the given menu. Hit save changes button at the bottom. That would create your new .htaccess file. If the problem is still not solved, carry on reading to find new solutions.
2. PHP Memory Limitations Cause Internal Server Error 500
Often the reason behind internal server error is that your PHP memory limit is crossed. Of course, you can not decrease the data but you can definitely increase the memory. Lets check out the method of increasing memory. There are number of files in which you can make changes to get more memory.
Login to your wordpress directory. Now, download the wp-config.php file. You need to modify its code. Open this file in any text editor. Add the following line.
define (‘WP_MEMORY_LIMIT’ , ‘300M’);
Remember that you need to replace the line
/* That's all, stop editing! Happy blogging. */ with the code we wrote above.
It would increase the PHP memory limit to 300 MB.
Now save the changes and upload the file to your WordPress directory. You can overwrite your existing wp-config file.
The seconf file you can also use .htaccess file to increase PHP limit. As you know, it can be found in root directory, navigate to root directory and download it. Add following code to it.
upload_max_filesize = 64M
post_max_size = 64M
file_uploads = On
- Create a new file.
- Open it in any text editor.
- Type the line written in next step.
- Save the file as php.ini
- Ensure that you write .ini extension properly.
- Be sure that you choose ‘All types’ in the field of ‘Save as type’.
- Upload this file to the wp-admin sub-folder within your WordPress directory
3. Fix The Naughty Plugins to Fix Internal Server Error 500
Sometimes your faulty WordPress plugin can lead to internal server error. Fixing them can solve the problem instantly. Specially if both of above methods have failed, there are nearly 100 percent chances that it is all because of some evil plugin.
If you can access your admin area. Go to plugins page and deactivate all the plugins by checking the bulk option, and then check your site. Login to WordPress directory and locate the plugins folder in wp-content folder. Rename the plugin. You can have some new name like plugin_old. It would deactivate all of the plugins. Do not hesitate to do it. You would only lose plugins not your website or its data. Now check if your site, if it is working. Congrats if it is working. But your work is not finished yet. Of course, you can not afford deactivating all plugins. Also, you can not afford not to know the name of that bad plugin which caused you so much trouble.
Now rename your plugins_old folder back to plugins. Of course now you can access your admin area. So go to plugins and start reinstalling all the plugins one by one. Right after every plugin installation, check if the site is loading. Eventually you will be able to catch the miscreant plugin, because after installing that plugin, internal server error 500 would re appear. Fix the error in the same way we have discussed and do not install that plugin again. You can also delete that plugin via FTP and contact the developer about mishap.
4. Your WordPress Core May Get Corrupt
You may have lost the patience, if the error is still not solved. Be patient, these errors sometimes require some extra time to be removed. Probably if all above has failed, than the one to blame is corrupt wordpress core files. That is very rare case. In order to repair your wordpress core files, you need to upload new and fresh versions of your wp-admin and wp-includes folders. Navigate to the website WordPress.org. Download the fresh version of WordPress.
Now that you have downloaded WordPress, you have to extract WordPress.zip archive. Open the wordpress folder. Look for wp-admin and wp-includes folders. Use FTP for logging in to your WordPress directory. After you login, just overwrite the older versions of wp-admin and wp-includes folder with the new and fresh versions of theirs. Now refresh your site to check, if the error is still there. Congratulations, if it is working and do not get get disappointed if it is not. We are still not out of stocks. We definitely have some more hacks to try.
Warning: Before overwriting wp-admin and wp-includes folders, be sure that you have taken the backup of your site. Sometimes resolving these errors can be more difficult than you have expected. WordPress site consists of third party themes and plugins. Auditing the source code without precautionary measures is just like swimming in dangerous waters.
5. Debugging WordPress May Work
If you enable WordPress debug mode, you will be allowed to write all errors to a file called debug.log and which is stored inside wp-content folder. For enabling debugging, you have to log in to your WordPress directory and download wp-config.php file. Open it and add the following code just before the line /* That’s it, stop editing! Happy blogging */.
- define (‘WP_DEBUG’, true);
- define (‘WP_DEBUG_LOG’, true);
- define (‘WP_DEBUG_DISPLAY’. false);
- @ini_set (‘display_errors’, 0);
Save your changes. Now, upload wp-config.php file to your WordPress directory. Just overwrite the older version. Now reload your site to initiate the error. After that go to your WordPress directory again. Reach out wp-content folder and open debug.log file. You can take help from any developer friend to decrypt the error.
6. Your Hosting Provider May Help to Fix Internal Server Error 500
We have covered all the common cause of internal server error 500 in wordpress. If you are still unable to solve the problem, contact your hosting provider. Request the technical experts to resolve your issue by going over your server settings. Hope you liked this guide for resolving internal server error 500 on wordpress sites. The main reasons are bad plugins, corrupt files and exhausted PHP memory limit. Just do not panic and follow the methods explained in this article.
If you are looking to get your business website developed at a fraction of cost with all premium features and qualities, you are at the right place. MT Web Sol deals in all kind of Website Development Services. Get in Touch with our experienced team to discuss your next web project.