|
CGI
_ What is it? and How Do I Use it?
Part
of the course for HTML 2 is using cgi. While it
is not covered extensively there are usually some
questions that hopefully this will help answer for
those who attempt to use their own cgi bin if provided
by their host.
There
are a number of different methods Web developers can
use to enhance the content of Web pages over and above
what simple HTML provides. Most of these methods
involve writing little programs or routines using a
scripting language or another.
CGI
is utilized by placing an appropriate HTML tag in your
HTML code. The script is called for by the server and
executes the script file that is specified in the tag.
Create
a sub-directory (folder) in your root Web directory
called cgi-bin by using your ftp program. Many isp's
already have the folder there. Your scripts will
not run unless your server allows cgi and not all do.
Once
you have set up your cgi-bin and downloaded the script
you want to use you must follow these steps:
1.
Modify the script for your server. Mainly it
will be things like your domain, your sendmail, and
your e-mail address that will have to be modified in
the script itself. Most downloaded scripts give
directions on what you will have to modify. You
will have to contact your hosting service to find the
path to "sendmail" for use in your scripts,
if it is required. Most hosts have faqs and
directions for the use of cgi and the different paths
that will need to be set.
2.
Transfer the script's files (the script file itself
and any necessary data files) to your cgi-bin and set
the permissions. Permissions are done through
CHMOD which sets permissions on your file as to
who can read it, write to it and execute the file.
These permissions are necessary so your Website
visitors can have your scripts execute so they can
access them. There is a great tutorial found
here from WSFTP http://faq.solutionscripts.com/misc/chmod_ws_ftp.html
3.
Add the script's HTML tag to the page where you want
to use the script.
Some
of the most common uses of these scripts are for web
page counters and contact forms. You can
download many free scripts from the internet.
Here is a link to The
CGI Resource pages where you can found countless
scripts and site where you can host your cgi script if
you do not have that capability on your own server.
There you have it - happy scripting :)
|