Here are a number of frequently encountered errors that can prevent your .cgi scripts from working properly:

  1. forgetting to put #!/usr/bin/perl at the top of the .cgi file: The server does not magically know how to run your program. In particular, a .cgi file could just as easily be a php file as a perl file so it cannot even guess what interpreter to run based on the file extension. If you do not put the above line at the top of your program, then our server will treat your program as a shell script and you will get a server error.
  2. forgetting to call the header, start_html, and end_html functions: if you do not call these functions when you create your dynamic web page, then the server will not know how to interpret the text file it receives and it will generate a server error.
  3. permissions not set properly on root (i.e., ~username), www-home, or cgi-bin: It is not enough to make your cgi scripts world readable and executable. You must make sure that the chain of directories that are followed to get to your cgi scripts are world readable and executable. This means your top-level directory, www-home, and cgi-bin directories must be world readable and executable.
  4. not using a .cgi extension. Our servers won't accept .pl or .perl extensions.
  5. not putting your cgi scripts in ~username/www-home/cgi-bin. Putting your cgi scripts anywhere else will cause a server error.
  6. not using as your URL (www does not work)
  7. syntax errors: This one is a surprisingly common cause of server errors. The browser will not tell you if it is a simple syntax error in your program. You can check this one by running your cgi script from the command line using "perl filename.cgi".