Home

Penpals

Free Web Site

Career Advice

Travel Guide

Welcome to Zimbabwe Online

Recommend This Web site | Help Desk | Hot Tip

Read your Email
Internet Made Easy
Shopping
Forums
E-Business
Newspapers
Calculator
Living with HIV
Classifieds
Directory
Business Cards
Romance
Recipes
Calender
Human Rights
Currency Converter
Messenger
 
Internet & Computers

What is cgi?

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.There are several languagea 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 website which allows the execution of the scripts.Most commercial webhost such as beegee-internet offer this service as standard.

You can drive around the internet for ready avaliable 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 comminication 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 website and your script.Whilst an url or website address can be simple as: http://zimbabweonline.info
and a script with an address such as :http://www.zimbabweonline.info/cgi-bin/scriptname.cgi - a server path will seek to trace the actual storage place of your website and script on the harddrive of the server.
The url above will then have a server path such as: ' /home/sites/www.zimbabweonline.info/web ' and '/home/sites/www.zimbabweonline.info/web/cgi-bin/scriptname.cgi '. Unfortunately we can not list any examples of server paths as they really differ with each server and website.

It might also be useful toknow 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 webserver 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 recognise it as a script.Connect to your web server and upload the script in ascll mode.Normally cgi scrpits reside in a directory named the cgi-bin ( just a normal directory with the power to execute cgi scipts ).Chmod your script to 755.This is the same as giving the script permission to do certain things.Other polular chmod codes are 777 and 644,usually for directories.

Now - you will need to check your progress by simplyly pointing your web browser (Internet Exploerer,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.

ZimbabweOnLine - A Bee Gee Initiative - Copyright © 1999 - 2004