BuycPanel Blog

BuycPanel Blog

Latest news and updates

1/08/2015 – Resolve an Internal Server 500 Error

Posted by Jamison on 08 01 2015.

Errors are the last thing we want to see, but they will happen. It will only be a matter of time before they do. One of these is the Internal Server 500 error. This is usually caused by many reasons, there are three types of this particular error:


  • Bad Permissions, Writeable by group
  • Bad .htaccess, Invalid Command
  • Exceeding Resources, Nothing in the Error Log


Each error type has to be dealt with in its own way. To begin the troubleshooting process, log into cPanel. Go to the Logs section and click the Error Log icon.


This log will display the last 300 Error Log messages starting from the oldest one. If the Error Log tells you nothing about the issue, try troubleshooting by performing the following steps for each type:


For Bad Permissions, Writeable by Group error


  1. In cPanel, go to the Files section and click File Manager.
  2. Select the button for Web Root (public_html/www).
  3. Check the box titled Show Hidden Files (dotfiles).
  4. Click Go.
  5. Review the numbers listed under the Perms column in File Manager. Directories and folders should be set to 755, executable scripts within the cgi-bin folder must be set to 755, while images, media, and text files like HTML should be set to 644.


For Bad .htaccess, Invalid Command


This error might have been caused by the presence of a command line in the .htaccess file that was either wrongly worded or in conflict with other codes in the file. Broken command lines and lines that start with php_flags are also common mistakes.


The best way to troubleshoot this is to comment out the lines in the .htaccess file.


Note that before you do this you should always make a backup file of the .htacess file before making any changes to it.


You can comment out any line in the .htaccess file by adding # to the beginning of that line. Let’s say the code in the .htaccess file looks like:


DirectoryIndex default.html

AddType application/x-httpd-php5 php


Put the # to make it:


DirectoryIndex default.html

#AddType application/x-httpd-php5 php


If the problem remains and you still cannot determine which line is faulty, then comment out all the lines. After that you have done that, refresh the site to see if the issue has been resolved.


If everything works fine now, this will only confirm that the issue was in a particular line of code in the .htacess file. If the problem persists, go on troubleshooting by commenting out additional lines and checking the site again once you are done.


Exceeding Resources, Nothing in the Error Log


This particular Server 500 error may be caused by too many processes in the server queue. Using SSH access, you can view the processes running on your account, just type the command “ps faux” (don’t include the quotes) or type the following command to view a specific user’s account “ps faux |grep username”.


After you get the process ID (pid), type the command “kill -9 pid” to kill the specific process, then be sure to replace pid with the actual process ID.