How to Fix “Internal Server Error 500”

The most common reasons for 500 errors:

 

1) Bad permissions, Writable by group

Directories and folders should be 755. Executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.

 

2) Bad .htaccess, Invalid command

In the (dot) htaccess file, you may have added lines that are either worded badly or conflicting. The best way to troubleshoot this is the comment out the lines in the htaccess.

You can comment out a line in the .htaccess by adding # to the beginning. You are wise to save an original copy of any file before you make changes.

For example, if the .htaccess looks like

Directory Index default.html
Add Type application/x-httpd-php5 PHP

Then try something like this

Directory Index default.html
#Add Type application/x-httpd-php5 PHP

Broken lines and lines that start with php_flag are the most common mistakes. If you cannot determine which line is the problem, then comment out every line.

 

3) Exceeding resources, nothing in the Error Log

It is possible your 500 error is caused by too many processes in the server queue.

With SSH (shell) access, you can view the processes running on your account. Simply type this command:

Ps faux

Or type this to view a specific user’s account (be sure to replace username with the actual username):

ps faux |grep username

Once you have the process ID (“pid”), type this to kill the specific process (be sure to replace pidwith the actual process ID):

Kill -9 pid

How to Redirect an URL in cPanel

  1. Login to cPanel and click the Redirects icon.
  2. Leave the setting as 301 redirects, as this is preferred by search engines.
  3. Select the appropriate domain name from the drop-down.
  4. In the subsequent blank, enter an optional path and file name; this exact name must be typed to trigger the redirect.
  5. In the large blank, enter the full URL for the redirect target; include http:// or https:// (e.g. http://hivelocity.net).
  6. Leave the other settings as they are, unless you know why you want to change them.
  7. Click the Add button and you are done.

How to Backup & Restore MySQL Database in cPanel.

  To backup the databases please do the following:

  1. Login to your control panel and click Backups.
  2. Under Download a MySQL Database Backup, click the name of the database.
  3. Click Save As.
  4. Select a destination for where you would like the back up to be saved, locally.

Once you have a backup, if you ever inadvertently lose your data, then you can restore the database easily and quickly.

To restore a database, please do the following:

  1.  Login to your control panel and click Backups.
  2.  Click the Browse button next to the option which says Restore a MySQL Database.
  3. Select the .sql.gz file which you want to be restored.
  4. Click the Open button and click the Upload button.

Your database driven website should be working again.

How to change file permissions in the File manager of cPanel.

One of the easy and basic ways to change the permissions is through File manager in cPanel. To change the permissions for a file or folder in cPanel, please do the following:

  1. Click File Manager.
  2. Click the name of the file for which you would like to change the permissions.
  3. Select the Change Permissions link at the top right of the page.
  4. Select the permissions you would like to set for the file.
  5. Click Change Permissions.