Cgi
is becoming almost a standard for almost all websites.Its
a program which automates and brings interactive to thousand
of million websites world wide.Cgi stands for 'Common Gateway
Interface'.The full name its self gives us a clue the interface
is platform independent - it is a standard for interfacing
external applications on web servers.Ther are several language
to write cgi programs such as perl,asp,c and c++ and python
.However perl is the most popular.Most perl scripts use
the following extensions 'cgi' and 'pl'.
These programs are only useful if you have a web site which
allows the execution of the scripts.Most commercial web
host such as beegee-internet offer this service as standard.
You can drive around the internet for ready available cgi
programs.Most of them - painless to install.Php scripts
are only uploaded and work without any other variables.Here
is the run down of a basic perl installation applicable
to almost every script.
First and most important - you need to know your path to
perl( also known as perl compiler ).This is the driver and
communication medium between the script and the web server.The
path is found on the top of every script and looks like
this'#!/usr/bin/perl' 0r '#!/usr/local/bin/perl'
You will also need to know your server path to your website.This
works more like a web address,which will correctly identify
your web site and your script .Whilst an url or web site
address can be simple as: http://www.isp.co.zw and a script
with an address such as :http://www.isp.co.zw/cgi-bin/scriptname.cgi
- a server path will seek to trace the actual storage place
of your web site and script on the hard drive of the server.The
url above will then have a server path such as: ' /home/sites/www.isp.co.zw/web
' and '/home/sites/www.isp.co.zw/web/cgi-bin/scriptname.cgi
'.
Unfortunately we can not list all the examples of server
paths as they really differ with each server and web site.
It might also be useful to know your sendmail.This will
be responsible for sending any email depending on your setting
and the script.The is the most alternative function in place
of a mail server.Most web server have their sendmail as
'/usr/lib/sendmail' and ' /usr/sbin/sendmail '. Please check
the right one for your server!
Editing your script.
You will need to use a text editor such as Notepad on windows
machines .Please do not use win word and word.They tend
to mess the script around.On a Apple Macintosh - use the
script editor or simple text .Remember cgi-scripts are written
as normal text files.
Once all the editing is done - you need to ensure your script
has the right extension such as 'cgi' otherwise your web
server might not recognize it as a script .Connect to your
web server and upload the script in ascll mode .Normally
cgi scripts reside in a directory named the cgi-bin ( just
a normal directory with the power to execute cgi scripts
).Chmod your script to 755.This is the same as giving the
script permission to do certain things. Other popular chmod
codes are 777 and 644,usually for directories.
Now - you will need to check your progress by simply pointing
your web browser (Internet Explorer,Netscape Navigator etc)to
the script.Type the url to the script such as ' http://www.yourserver.com/cgi-bin/scriptname.cgi'
.All should be well depending on your script and settings.