CGI Frequently Asked Questions
Your Perl CGI script should begin with #!/soft/perl5.8.7-bin/perl -w
Your Python CGI script should begin with #!/soft/python-2.4-bin/python
Your home directory should have permissions of 701, your .www (and
any sub-directories containing your script) should have permissions
of 701, and your CGI script itself should have permissions 755. If
you're not sure how to do this, see the
CGI scripting Tutorial for detailed instructions on setting up
a CGI script.
Yes. The CGI script and the enclosing directory must be owned
by you. In addition, the group of the file and enclosing directory
must be the same as your default group. To find your default group
use the id command. Failing to do any of the above
will result in an Internal Server Error.
Run it from the command line. Simply cd to the directory
containing the script, and type ./<scriptname.cgi>,
where <scriptname.cgi> is the name of your CGI
script. The first line produced should be:
Content-Type: text/html
...followed by a newline and then the output of your script. If the above line
is not produced, or it's not followed by a blank line and then some
content, an Internal Server Error will be displayed. Also, you might
find that the script produces the following prompt when you run it:
(offline mode: enter name=value pairs on standard input)
If this happens, type control-D and the output of the script will be
displayed.
Depending on the type of account you have, you can find the output of the error logs with the following commands:
- IT Labs: tail -f /web/logs/www-users.itlabs_error_log/error_log
- CS: tail -f /web/logs/www-users.cs_error_log/error_log
The error logs contain the output created when your CGI script generates an error. This can help debug the CGI script.
First, re-check the above questions and the
CGI tutorial to make sure you've followed all of the steps documented
here. 95% of CGI-related problems are caused by one of the
above requirements not being met. If you are meeting the above requirements, be sure to check the error log
to see what error message is being generated.
Once you've double-checked that none of the above
answers solve your problem, then contact Systems Staff.
|