Using CGI Scripts in your web space at FIU-CIS
Updated April 23, 2003
John Flynn, Author
Using CGI scripts here at FIU-CIS is very simple. Any script, so long as it ends with the extension .cgi and is set u+x, will be treated as a CGI script by our web server.
First, you must have an CIS or JCCL UNIX account and a web space set up. If you have
not yet set up your personal web space, do so as follows:
-
cd ~
-
mkdir public_html
-
chmod 755 public_html
This will create the public_html directory in your account, where all your
web pages will live. This is also a good opportunity for you to write up your
personal web page.
The next step is to write your CGI script and save it to a file with the .cgi
extension. Let's call the script "info.cgi" for this example, and assume you saved it in the top level of your public_html tree. You must then
set the script to be executable by you, as follows:
-
chmod u+x info.cgi
At this point, you should be able to access the script at: http://www.cis.fiu.edu/~yourusername/info.cgi
If you are a JCCL user, the URL is: http://www.aul.fiu.edu/~yourusername/info.cgi
Here at CIS, we run the suexec option on our Apache web server. This means
that all CGI scripts accessed within your account will run as you.
It is extremely important that you audit the security of any scripts
that you write. Note that when one of your scripts executes, it has the same
permissions that you have, and can do anything that you can do with your
UNIX account. It is your responsibility to ensure that your script is secure
and cannot be used to damage your files.
If your script generates server errors, debugging information is available. Simply go to
/depot/http/www.cis.fiu.edu/logs and use the UNIX tail command to look
at the end of the error_log file right after you access your script. This
file is likely to contain information as to why your script failed.
If you need more information on how to develop CGI scripts, you can try doing a search for "cgi script introduction" on your favorite web search engine. There are countless resources on the web to learn CGI script development.
|