- Check that you have set everything up properly according to the instructions online here: https://users.monash.edu.au/about/
- Make sure that any Perl CGI scripts you have end with extension .cgi On users.monash, PHP scripts must end with .php
- Make sure that any CGI scripts you have reside in your directory www/cgi-bin or a sub-directory of this. They should not be directly in the www directory with your XHTML files or the web server won't be able to find them.
- If you are using Perl, you need to find the Perl interpretter on the users.monash.edu.au system (or whatever system your web page is served from). Login to the web server.
Then, you can use the UNIX command which (type man which for instructions). If Perl is in your path, which will tell you where it is. e.g. when I type it on my machine prompt I get:
> which perl
/usr/bin/perl
>
You might find Perl somewhere else! If it is not in your path, go and look in /usr/bin and around there to see if you can find it manually.
Be sure to include the first line of the perl script as #! then the path to Perl. Do not indent the #!, it must be in the leftmost column on the first line of the file.
-
Make sure that your Perl script is executable (do an ls -l) to check, or chmod +x yourFileName.cgi to ensure this. The permissions should at least be: -rwx------
-
Try running the Perl script directly from the command line under UNIX. Does it work ok? To do this, you might need to comment out any need for input CGI parameters (or pass them to the Perl script from the command line or environment variables) then type:
> perl test.cgi
at the prompt.
- Open the CGI script in the vi text editor on the Unix web server. Make sure it has no funny ^M characters at the end of the lines. These are often inserted when you edit the file using a Windows text editor. Windows uses \n\r at the end of each line, UNIX only requires \n. If the ^M characters are there, remove them from the file (In vi, globally replace them with nothing).
- Try adding a blank line to the end of the script file after the last line of code. Some interpretters need this after the last line of code.
- Make sure that before you print anything out from your CGI script, you return the header information to the client. You can do this using the CGI.pm method print header; or with a normal print statement print "Content-type: text/html\n\n"; Don't forget the double newline!
|