If you got a message stating that 'An Error has Occurred'
Your CGI tried to execute, but the code has a flaw in it. Return
to the Unix prompt (still in the perltour directory), and type perl test1.cgi
and press [ENTER]. The Perl debugger will tell you what is wrong.
Check for a semicolon at the end of each line. Double check the path
to Perl and Sendmail. Also, if you pasted the code from the web page, be
sure there are no spaces at the beginnig of a line.
If you got a message stating that 'Access is Forbidden' or 'Permission
Denied'
You need to set the permissions of both the file and the cgi-bin folder.
At the Unix prompt (still in the perltour directory) type chmod
a+rx test1.cgi and press [ENTER].
Then type cd .. and press [ENTER] to go up one level, and type
chmod a+rx perltour and press [ENTER]
This should fix it.
If the script appeared on your screen
The server is not recognizing that this is a cgi script. You
should contact your system administrator and ask "What is the appropriate
location for cgi scripts?" There may be a specific directory already
created on the server called 'cgi-bin' which must contain all CGI scripts.
If you are told that CGI scripts are not allowed, or that someone else
must copy them into the cgi-bin before you can use them, you need to get
an account somewhere else. I recommend http://www.hardlink.com.
They are only $100 per year, and they give you full access run any script,
in any folder, as long as it ends with .cgi. Also, this is the server
I use, so the template examples are guaranteed to work.
To locate the cgi-bin directory on your machine you will use the find command. The find command will start with any directory you specify and search the contents of everything beneath it.
I'm going to try searching /user/web/ for now, but if that doesn't work, I will try searching just /user/ or as a last resort, just a forward slash / to indicate the root (top most level).
From a command prompt, type:
find / -name cgi-bin -print |& grep -v
denied and
press [ENTER]
(this may take more than 20 minutes, but it's faster usually faster than
waiting for your sys. admin to get back to you).
If there is a cgi-bin on the server which you have permission to use, it
will eventually show up on your command line. After you create your
scripts, you will need to copy them to the cgi-bin. Use the Unix guide on
page 1 for copying instructions.
IMPORTANT: If your server uses a cgi-bin, then the
forms on your HTML pages must have the script
name preceeded with /cgi-bin/. For example, instead of opening a
form with
<FORM ACTION="echo.cgi" METHOD="POST">
I would now write
<FORM ACTION="/cgi-bin/echo.cgi" METHOD="POST">