This article will discuss the commonly known causes of the 500 Internal Server Error and the general troubleshooting steps in resolving them.
An Internal Server Error (ISE), also known as a 500 error, is not specific only to WordPress. This error can be caused by a PHP function not working as intended, whereas a database error causes 500 errors. Both errors can, however, be resolved in the same way. Finding the cause of a 500 Error and then resolving it is often a matter of trial and error.
The 500 Internal Server Error is presented in several ways, which may include the following:
"Is your domain properly connected to your web host?"
One of the basics of troubleshooting web pages is ensuring that the domain (your website name) is active and properly connected to your web host (your hosting plan). Ensuring that requires you to check your DNS records. Let's think of it as checking the "bridge" connecting your website and your hosting server.
"Did you already try clearing/deleting your browser's cache and cookies?"
This may be a simple step, but most website error pages are caused by cache. The cache is a temporarily stored memory that helps your browser load a webpage faster. Sometimes it causes a problem when websites are updated as the web files saved in the cache may conflict with what is on the website. Clearing the cache fixes most website issues like that, including loading or formatting problems.
Here are some of the commonly known causes.
Your website has files and folders inside your web host, and each of these will have its permission settings regardless of the application used to build the site. Permissions can allow our server computer to write and edit your files. Also, some files need to be protected from writing and editing as a security measure.
To fix the 500 Error page caused by permissions error, you must ensure that your website files and folders have the correct permission settings.
A .htaccess file is an Apache file that tells a website how to function. As one of a site's core files, it is important to ensure that the .htaccess file exists and is properly configured. The script or code for a .htaccess is written depending on the CMS or application used to build the website. If the .htaccess is missing or misconfigured, you may need to manually upload or create a new .htaccess file.
If there are custom scripts in the .htaccess, you may need to contact your web developer for assistance as HostGator's Support cannot assist with customized scripts and coding unique to your website.
If you find an unusual script in your .htaccess, you can comment out a line by adding # to the beginning of that particular line. For example, if the code in the .htaccess file looks like:
DirectoryIndex default.html
AddType application/x-httpd-php5 php
Then, try commenting it out like so:
DirectoryIndex default.html
#AddType application/x-httpd-php5 php
Alternatively, you can create a new default .htaccess file instead.
If you cannot determine which line is the problem, comment on every line.
After commenting out a line(s), refresh the site to see if the issue has been resolved. If it has, that confirms that the issue was in that particular line of code in the .htaccess file. If the issue has not been resolved, continue troubleshooting by commenting out additional lines and reloading the website.
Too many processes may be causing the 500 error in the server queue.
With SSH (shell) access, you can view the processes running on your account. Type this command:
ps faux
Or type the following command to view a specific user's account. (Be sure to replace the username with the actual username.):
ps faux |grep username
Type the following command to kill the specific process once the process ID (pid). (Be sure to replace pid with the actual process ID.):
kill -9 pid