Getting HTTP 500 internal server error
500 internal server error is an HTTP status code which indicates an unknown error on a web server. If you try to view a website and receive a 500 internal server error, the problem is not in your computer, handheld device, or web browser. The error resides solely on the server that hosts the website.
500 error user troubleshooting
Despite the issue being something you can't control or fix directly, there are a few things you can try to rectify the problem from your computer.
- Try reloading the web page (press Ctrl + R on your keyboard, or click the reload icon ↻ in your web browser) to see if the error recurs.
- Try coming back to the web page at a later time. The site's webmaster or web developers are likely working on the problem.
- Contact the webmaster by e-mail. Many web pages have a link on it to contact the company (support e-mail) or the server hosted the page.
500 error webmaster troubleshooting
If you are responsible for the script or page generating this error, the following steps may help identify and resolve the cause of the error.
Script is not set as executable
All scripts uploaded to a server must have execute permissions (e.g., chmod 755 or -rwxr-xr-x). If you are uploading the file through a graphical FTP program such as FileZilla, right-click the file on the Server and click File permissions to see the permissions.
File is not being uploaded as ASCII (Text)
When uploading any Perl or PHP script file, make sure that the file is uploaded in ASCII (text) mode and not binary mode. If your program is uploading the files and mode is automatically be set, try switching to manual and make sure it is ASCII (text) mode.
Perl script doesn't have a shebang or Content-Type
If you are uploading a Perl script (files ending with .pl or .cgi), it must have a shebang as the first line and a Content-Type line before any print command. Below is what we recommend having at the top of all your Perl script files. Adding the "fatalsToBrowser" line to your script will print any error to the browser window, which helps debug the script if there are errors in it.
#!/usr/bin/perl use strict; use CGI::Carp qw( fatalsToBrowser carpout); print "Content-Type: text/html", "\n\n";
Not uploaded to the correct directory
Make sure the script file is being uploaded to a directory that has executable permissions. In the case of Perl files, we suggest uploading all Perl files to the public_html/cgi-bin/ directory.
Make sure the file is formatted for Linux
If you have created or edit the script file in a Windows editor such as WordPad or Notepad, these editors can end each line with a different character, which will break any script. If you have access to a shell account on the computer you are uploading the script to, run the dos2unix command to convert that file into a file that does not contain invalid characters.
Testing the revised script
Finally, if all the above suggestions have not helped and you continue to experience the issue verify the script has no errors. For users running Perl script, run the following command. If you do not have access to a shell account or a computer with Perl, we suggest installing Perl on your computer.
perl -wc scriptname.pl