Mostly, we can figure out the mistakes from the type of error which the browser shows. Hopefully there is no bug in the script itself. (Let us believe the script is well written and has been checked in various environments). Here are some possible major error messages which may occur:
You can get a server error 500 for many reasons, some of which occur IF
† the script does not contain the “#!/usr/local/bin/perl” header line that points to the Perl interpreter, or if the path to the interpreter (and/or a library file) is invalid.
† the first line output from the script is not a valid HTTP header (i.e. “Content-type: text/html”), or there is NO blank line after the header data.
† there is a syntax error in your script. Always run it from the command-line first.
† Check to make sure that the ACTION=”” of your script is pointing to the correct CGI program. If it is, make sure that this file is also chmoded 755 so that everyone, including the Web Server User ID has permission to execute it.
†Make sure all files to be opened during execution by the script are chmoded so that the web server can read them
†Check all paths to certain commands and make sure they are correct. An incorrect path in your script will cause execution of your script to halt
Check them and run the script again. I hope you’ve got it!
Make sure that all of the URLs are correct in the scripts and that when the necessary portions of certain URLs are combined they form complete URL. Many do enter the URLs wrong or do not change them from the standard distribution. You can avoid this by double checking your entries.
CGI scripts can be configured to run on most systems in two ways, the first, inside a cgi-bin directory. Error 501 usually says that the server does not support the method POST to a non script area. This means that since you do not have your files in a server defined cgi-bin, the server will not allow the POST method to these files, and will not execute these scripts.
Simply linking from your page to an executable program or script won’t cause it to be run on the server. There are two common arrangements: either files in directories especially designated by the server administrator are executed as CGI scripts, or files with a special extension (such as .cgi) are executed as CGI scripts. Some times you may need to rename PL files into .cgi to make the server understand your script type, but this is very rare.
These are just two possible ways your server might be configured. Many sites don’t allow users to run CGI scripts at all. Consult your web server’s administrator and make sure that you have the access for a cgi-bin..
This error is generally caused by the wrong path. Make sure that the path is to Perl. (Like ” /usr/bin/perl”) Also make sure that the path in your HTML document is correct.
Some browsers are tolerant of incorrect Content-type headers, as well as of null characters in text/html or text/plain output. Make sure your output is strictly correct; it helps to check the script with different browsers.