500 Internal Server Error

The Problem: 500 Internal Server Error Help

This error normally will look something like this:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

 

What Causes a 500 Internal Server Error?

If you’re seeing a 500 Internal Server Error, the server wasn’t able to fulfill a request that appeared to be valid. Any error code that starts with the number five (5) means the server knows it’s come across a problem and isn’t able to do what’s requested.

A general 500 Internal Server Error is probably caused by a simple mistake in the configuration somewhere on your site or a script that you’re using. It doesn’t tell you specifically what the issue is, as it’s a general error. (We’ll briefly explain other specific errors that start with five (5) at the bottom of this page)

Causes may include, but aren’t limited to:

 

  • Bad lines in the php.ini file
  • Bad lines in the .htaccess file
  • Invalid permissions
  • Invalid script requests
  • Invalid ownership
  • Misconfiguration in the web server configuration.

 

In order to find the exact cause, you should look at the error logs found in cPanel. If you need help, get in touch and one of our techs will be happy to help you figure it out.

 

How do I Fix a 500 Internal Server Error?

To fix a 500 Internal Server Error, there are several possible causes to investigate. First, make sure the .htaccess file is correct, then make sure the folders and files on your site have the correct permissions, check for any problems with themes and plugins and check PHP code for errors.

The solution depends on what originally caused the error. Once you’ve identified the cause then you can try to fix it. Here are some of the more common causes and what you can do to try to fix them…

 

Problems with the .htaccess File

This is probably the most common cause of a 500 error. If you’ren’t sure, follow these steps to determine if it’s the cause (if you couldn’t find the cause in the error logs):

 

  • Go to the File Manager in your cPanel

 

Showing where to find File Manager in cPanel

 

  • Set your File Manager to show hidden files

 

Showing how to show hidden files in cPanel

 

  • Rename your .htaccess file to something .htaccess.bak

 

Showing where to rename the .htaccess file in cPanel

 

  • See if the problem persists

 

If the error is gone, then it’s a problem with your .htaccess file. Change it back to the original name and start snipping out pieces of the code within the .htaccess file to identify which line is the problem. To do this easily and safely just put a number sign (#) without the parenthesis at the start of one line.

This will “comment out” that line so it’s not “read” when your site is loaded.

Do one line, then check to see if the error persists. If it does, add it to the next line and check again. Once you’ve found the problem line and fixed or removed it, remember to uncomment all the other lines.

If you check all the lines and the problem persists, move on to the next section.

 

Problems with file or directory permissions

Files and folders should have specific permissions set for them. You can see what they’re set to and change them by going to the File Manager in your cPanel and look for “Permissions.”

 

Showing where to change file and folder permissions in cPanel

 

The permissions should be:

 

 

If nothing here solves the problem, please get in touch with us on live chat or submit a ticket so we can help you get it sorted and your site back online.

 

Problems with WordPress themes and/or plugins

Sometimes a 500 error can be caused by a plugin or theme.  

If the error shows up after you’ve installed a new plugin:

 

  • Go to your File Manager
  • Go to the public_html/wp-content/plugins folder
  • Rename the folder for each plugin one at a time

 

If the error shows after you’ve installed a new theme:

 

  • Go to your File Manager
  • Go to the public_html/wp-content/themes folder
  • Rename the folder for the theme

 

If that fixes the site, try reinstalling the theme or plugin. If it throws the error again, simply change the name and leave it.

 

Problems with your PHP code

Issues with PHP can also cause a 500 error. Make sure you have PHP error reporting turned on so you can look and see there’s a possible problem. You can turn it on by doing the following:

 

  • Go to File Manager in your cPanel
  • Go to the public_html directory
  • Create a new file and name it php.ini
  • Edit this file and put this in it…

 

 

If your PHP code initiates external connections (Grabbing an RSS feed, etc), make sure you include a timeout handler. If a PHP script times out in a clunky way it can throw a 500 error.

Also, make sure sure PHP applications have enough memory allocated to them. If it’s too low, it will cause a fatal error.

 

Other Common Error Codes Beginning with Five (5)

 

501 not implemented

The server isn’t able to fulfill the request or it simply doesn’t understand what it’s requesting. The request method may not be valid or the server may not support the request method. In some cases, there may be software on the server that needs updated. This is often the case when something isn’t available yet, like new features being added to an API.

 

502 Bad Gateway

The server received a request from another server that’s not valid.  It may be displayed in various ways, including:

 

  • 502 Bad Gateway
  • 502 Service Temporarily Overloaded
  • Error 502
  • Temporary Error (502)
  • HTTP Error 502 – Bad Gateway
  • 502 Proxy Error
  • HTTP 502
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • 502. That’s an error
  • Bad Gateway: The proxy server received an invalid response from an upstream server

 

You’ll also often see “nginx” on the screen.

These errors are often just a quirky problem between servers online that you don’t have any control over. Other times it may be something you can thank your browser for. If you’re seeing this error, try clearing your cache, checking your internet connection and checking if the site works in another browser or from another connection. If it persists, please get in touch with us!

 

504 Gateway Time-out

This error is similar to the 502 one, but instead of not being able to fulfill the request, it simply isn’t getting a request. This may be a problem with the server or you may be running scripts that require more time to fully run.

First, refresh the page to see if it persists. If it does, you can try to fix this:

 

  • Make sure the .htaccess file is correct, especially if you’ve recently installed WordPress
  • If your site is running on WordPress, one or more of your databases may have become corrupt. There’s a plugin that might be able to help – WP DBManager. Use its repair feature, then use the optimize option and see if that fixes it

 

505 HTTP Version Not Supported

The HTTP protocol being used in the request isn’t supported by the server it’s sent to. Try using a different browser and see if it works, as it could be a problem with an outdated browser.

 

506, 507, 508, 510, 511 Errors

You could see a number other errors like these. The cause and solution will be dependent on where you’re seeing this. For example, are you seeing the error on a WordPress site or one of our cloud/dedicated servers? If you happen to see any odd errors like this, please just contact us so we can get a tech on it and help you get it resolved.


Share:

Leave a Reply