Getting HTTP 500 internal server error from website
500 internal server error is an HTTP status code which indicates an unknown error on an HTTP (HyperText Transfer Protocol) 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 later. 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 it.
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're uploading the file through a graphical FTP (file transfer protocol) program such as FileZilla, right-click the file on the Server and click File permissions to see the permissions.
End of line using Windows and not Unix
If you're creating the script in Microsoft Windows, the script likely does not have the correct EOL (End-Of-Line) characters. You can verify if this is the case through your text editor or with a command like dos2unix to convert the file.
In Notepad++ you can convert the EOL characters to Unix by clicking Edit and then EOL Conversion. Make sure the EOL is set to Unix (LF) (line feed).
File is not being uploaded as ASCII (Text)
When uploading any Perl or PHP (PHP: Hypertext Preprocessor) script file, make sure that the file is uploaded in ASCII (American Standard Code for Information Interchange) mode (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're uploading a Perl script (files ending with .pl or .cgi), it needs a shebang as the first line and a Content-Type line before any print line. Below is what we recommend having at the top of all your Perl script files. Adding the "fatalsToBrowser" line prints any error to the browser window, which helps debug the script if there are errors.
#!/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 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 edited the script in a Windows editor (e.g., WordPad or Notepad), these editors can end each line with a different character, which break scripts. If you have shell account access on the computer you're uploading the script to, run the dos2unix command to convert that file into a file without 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 a shell account or a computer with Perl, we suggest installing Perl on your computer.
perl -wc scriptname.pl