A Web.com Partner

Solving a 500 Internal Server Error

This tutorial will show you a number of methods for solving a 500 Internal Server Error

HTTP Error 500 – Internal server error

From the number of questions we get from new developers, it seems that one of the most dreaded errors that newcomers to PHP/MySQL and CGI face is the ambiguous “500 Internal Server Error”. It is one of the most uninformative error messages you can receive which can mean anything from an improper upload to a bug or error in the script and in most cases, incorrectly set file and directory permissions.


Your Web server encountered an unexpected condition that prevented it from fulfilling the request by the client (e.g. your Web browser or our server robot) for access to the requested URL.

This is a ‘catch-all’ error generated by your Web server. Basically this means something has gone wrong, but the server can not be more specific in its response to the client.

500 errors in the HTTP cycle

Any client (e.g. your Web browser or our robot) goes through the following cycle when it communicates with your Web server:

  • Obtain an IP address from the IP name of your site (your site URL without the leading ‘http://’). This lookup (conversion of IP name to IP address) is provided by domain name servers (DNSs).
  • Open an IP socket connection to that IP address.
  • Write an HTTP data stream through that socket.
  • Receive an HTTP data stream back from your Web server in response. This data stream contains status codes whose values are determined by the HTTP protocol. Parse this data stream for status codes and other useful information.

This error occurs in the final step above when the client receives an HTTP status code that it recognises as ‘500?.

For the uninitiated, a “500 Internal Server Error” is a message much like the common “404 File Not Found” message. You get the latter message in your browser when you try to access a non-existent web page. You get the “500 Internal Server Error” message when you try to run a script with problems.

File Permissions

AUSWEB’s Apache servers are protected with SuExec and additional PHP hardening modules like, Suhosin and Mod_Security . As such any files which are running the insecure file permission of 777 will result in a 500 error.

No files or directories should be set with full read, write & execute permissions, commonly referred to as 777 permissions. This would pose a great security risk and will always result in a 500 server error!

For some background information on file permission settings and values and what it all means, you can visit our CHMOD/File Permissions tutorial!

HTTP 500 errors – Common Causes

Even though a 500 error is generally a ‘catch-all’ error message, the problem usually comes down to two very common mistakes:

  • A file or folder permissions issue when attempting to access a script. Again for the security of your website scripting files incorrectly setup with full 777 permissions will fail and generate this error. Generally permissions can be set at 755 but this will be dependant on the script you are trying to use. You will need to make sure you correctly set file and folder permissions for any scripts you use to ensure they run smoothly.
  • An error within a script file that has caused it to fail, or output an error message before it could finish its task and produce valid HTML. Can occur for a variety of reasons such as a script becoming corrupted, or having invalid code, even small syntax errors.

It can be tricky to track down 500 errors, but you should always start by checking that the correct file permissions are set and then further at the scripts themselves. The most obvious starting point will be the area of your site that generated the 500 error. For example, if you were using an online shopping cart script, and adding items to the cart on your site when a 500 error is generated, the first place to look might be the scripting files specific to that function. Checking the correct permissions, and further to that checking the script itself are all correct.

You can adjust file and folder permissions of your website in the following ways:-

  • Using your cPanel account and the “File Manager” – via the explorer styled menu, simply adjust the “Permissions” entry on the right of each listed file and folder.
  • Using your FTP account, and using your specific FTP clients Permissions or CHMOD controls to modify the file permissions.

Note: While most FTP clients will support this widely used command, certain FTP clients may not. WEB24 recommend using FileZilla, CuteFTP, WS_FTP and we offer a range of video tutorials for managing file permissions with these programs Please visit our FTP Tutorials section!