CGI Overview
CGI programs (or scripts, as they are often called) are used to process, store,
and retrieve information gathered from users of web pages, usually through a web-based
form. CGI is sometimes mistaken for a programing language, which is not the case.
CGI programs can be written in a variety of programming languages, including PERL,
C, and C++. Scripts written in some languages, such as C, are compiled (converted
to binary executable files) before they are run on the server.
Scripts written in other languages, such as PERL scripts, usually are loaded as
ASCII text and run with the aid of a PERL interpreter (which is also running on the server).
If you are not up for the challenge of creating your own scripts, a
variety of scripts are available for free use, such as cgi-email, which
accepts the content of a web form and e-mails it to a specific e-mail address.
Creating Scripts
CGI-EMAIL - Form processing (form data sent via email)
FORMMAIL - Easy to use web based form emailer
Loading Scripts - Where and How to load scripts
All of Redwood's business web hosting account's include a cgi-bin directory off of your "www" directory. This is a convenient directory to place your CGI scripts. To call a CGI script that
is located in your personal cgi-bin:
If your domain name is company.com
http://www.company.com/cgi-company/Name_Of_Script
Although any script in the cgi-bin will be executed regardless of the name,
it is a good idea to end your script names with .cgi
(scripts placed in directories other than the cgi-bin must end in .cgi to run).
CGI Scripts that use the PERL programming language, or any script that is not already compiled, MUST be uploaded as an
ascii file. Do NOT upload it as a binary file.
How to use scripts
CGI scripts must end in .cgi if placed outside your cgi-bin directory, be uploaded as ASCII if they are not already compiled, and
they must be executable. To make a file executable:
from the prompt in telnet, type: chmod +x FileName.cgi and
from the prompt in telnet, also: chmod 755 FileName.cgi or
From your FTP software, Change File Attributes to be Publicly Executable or
Access WebShell from the control Panel and change file permissions to be "Other
Executable"
CGI scripts run as the user "nobody", which is the default permission of the
webserver. If your script must write to a file, the file must be world writable,
or the directory it is writing must be world writable, or the file or directory
must be owned by the user 'nobody'.
|