Okay so you have already finished reading all other articles on the web but not get any fix to this error. So I am providing you some tricks 😉
Sometimes while working with WordPress you might have seen 500 errors especially when you are working with ajax. But 500 internal server error is a misleading or vague term used to mention a group of errors that occurs either in the code or in the server. But it does not provide any real information where the error is.
So in this tutorial I am going to explain which problems in your backend that may cause internal server error
What does it mean by 500 internal server errors?
The definitions of the 500 internal server error are used as a vague term as I mentioned before. It can happen with any website running on a web server. Actually, they don’t give any real information about what really went wrong and caused this error.
The only thing that’s certain is that the error is caused by any errors in PHP or in the website configuration. But you can be sure that CSS, JS files don’t produce this type of error.
Resolve a 500 internal server error
1. Turn on WordPress debugging
Most of the time turning WordPress debugging on fixes the problem. login to your Cpanel. Go to dashboard and your WordPress directory root. Then find your
wp-config.php file. Open the file and check for this line of code
define( WP_DEBUG, false );
No change it to
define( WP_DEBUG, true );
Now reload the page you will see some changes. It may lead you to some information that may lead you to fix this problem. You occasionally face the WordPress white screen of death, you can also get the cause of this error. but in 30% of the cases you might not get any information. But it’s quite helpful if the problem is in the primary level.
2. Solving 500 error in ajax
Solving 500 errors is the most confusing thing what to do.You will get really confused what to do.Because its going on console. and when when you open console you will get only this message
500 Internal server error . Its a misleading indication.
But this trick will lead you to the right path. Go to directory root and then go to the
wp-includes file of your WordPress installation. Then find the
load.php file in this directory. Then change the
display_errors from 0 to 1
now on ajax request you will see where is the problem.You can also use this trick to solve 404 error in WP ajax
3. Increase server memory
Exhaustion of your server memory limit may also cause this problem more frequently. If you see an internal server error is due to logging in to your account or uploading any image/video/file you assume that its due to exceeding the memory limit
Most of the time you will get your server memory only 64MB which is not sufficient most of the time.To increase memory limit open your
wp-config.php file. and find for
WP_MEMORY_LIMIT . there you can replace this with this
Then check again. If you see error is solved then okay. But there may be other problem that’s is, there might be a piece of code either in plugins or installed theme that may cause exhaustion of the memory limit. To find out that lines of code you may follow No.1 point.
4. Deactivate all plugins and switch active theme
Most of the time this error may be due to a plugin or theme. If switching your theme solves the error then be sure that problem is with the theme.
If not, try uninstalling plugins one-by-one to figure out which plugin is causing this problem. But if the theme causes the problem you will get stuck first on activating.
5. Check your .htaccess file
The .htaccess file, if it exists, contains a number of rules that tell the server what to do in certain circumstances. It is commonly used for rewriting URLs or preventing access to your site for malicious intent.
Use your FTP editor and check if you have an .htaccess file in your WordPress root folder. You may need to make sure your FTP editor lists hidden files before you do this.
If there is a .htaccess file there, make a backup and then delete all the contents within, or the whole file. This may remove some important rules, but if the internal server error was caused by a mistake within the file, this will tell you.
If the error is now resolved, the issue was with the .htaccess file. Try restoring the file and then deleting blocks of it. If at some point the site starts working, you know which block the issue is in. You can narrow it down to a single line like this usually. You can then remove that line or ask your developer or your host for further assistance.