Main navigation | Main content
Your Perl CGI script should begin with:
#!/soft/perl5.8.7-bin/perl -w
Your Python CGI script should begin with:
#!/soft/python-2.5-bin/python
The way our server is configured, you need to name your executable CGI scripts with the .cgi extension.
If you're not sure how to do this, see the CGI scripting Tutorial for detailed instructions on setting up a CGI script.
Note: Make sure that your CGI scripts and the directories that your CGI scripts are in are not group or world writable, otherwise our server will not execute them.
For security reasons you should never make your files or directories world writable and you should have a good understanding of the security implications before you make any files or directories group writable. This is especially true of web-accessible files and directories.
Yes!
To find your default group use the id command. The value returned for gid will be your default group. (number and name)
Failing to set the owner and group correctly will result in an Internal Server Error.
Run your script 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 of output returned should be:
Content-Type: text/htm
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.
Check the Apache Error Logs Page for information on where to find and how to access error logs.
First, re-check the answers to the questions and the steps outlined in the CGI tutorial.
Most CGI-related problems are caused by one of the above requirements not being met. Also, be sure to check the Apache Error Log to see what error message is being generated. If you have double-checked the CGI tutorial and the FAQs on this page and you are still experiencing problems getting your scripts to run, contact Systems Staff.
If you are trying to run a script on a Windows computer, you may get an error that looks similar to this:
[date][error][client] suexec failure: could not open log file
[date][error][client] fopen: Permission denied
[date][error][client] Premature end of script headers: ruby.cgi
First, Check to make sure you don't have any strange newlines. It could be that you have Windows newline characters that are causing problems. SSH to one of our Solaris machines and type the following command:
% dos2unix <<file>> <<file>>
This command will convert Windows newline characters to Unix ones and clear up the error.