Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

Introduction of CGI Porgramming

Post Bank
Posting Manager
******

Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.

Signin to Remove this Post

casien
Newbie


Posts: 8
Group: Registered
Joined: Sep 2006
Status: Offline
Reputation: 0
Points: 0 (Donate)
Post: #1

Introduction of CGI Porgramming


What is CGI?

CGI stands for Common Gateway Interface, which is a standard for external gateway programs to interface with information servers such as HTTP servers. CGI is not a program or a programming language. It is a collection of protocols (or rules) that allow Web clients to execute programs on a Web server and receive their output (if any).

Usually, the most common way for CGI to work is that the Web client (users) enters input data (if needed, some CGI programs do not need any input, such as "Hello Somebody" example mentioned earlier) , which are transferred to the server based on some protocols. The server receives the input, then passes the input to the CGI program. Then the CGI program is executed (fore example, by either sending mail to somebody via Formmail, or returning the search result back to the users if it is a search program...).

Where to Put CGI Programs?

Can we put our CGI programs(scripts) to any directory to make it run? Obviously the answer is "no". Before you write your own CGI programs, you'd better make sure whether you have permission to execute CGI scripts. Otherwise you are just wasting your time.

Most often we see people place their CGI program in server's cgi-bin directory. When you want to use your own CGI programs, you must first ask the web master to put your CGI programs in the cgi-bin directory. But this is not the only way.

Usually, the web server controls access to directories or files through Access Configuration file. Different server have different way to implement it. For example, for Apache webserver and NCSA httpd server, there are two methods for controlling access to directories:

* Global Access Configuration File

A document in server's conf directory, by default is access.conf, which controls access to any directory in your tree. For example, we can give the cgi-bin directory permission to execuate CGI program, of course we can give other directory the same permission in server's home directory. But this is not recommended for security reason. This is why cgi-bin is the most common way. This can be only defined by the web master or system administrater.

* Per-directory Access Configuration File

The default file is .htaccess, which control access to directory and its sub-directory. This can be define by the common user. But this can be restricted or completely forbidden by the Global ACF.

So Now we can see that there's two ways to place your CGI programs:

* Ask your web master to put your CGI scripts in the server's cgi-bin or other directory with CGI execuation permission.
* If not forbidden by the global ACF, you can add this statement to your .htaccess file( which should locate at your own web root directory):

AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl

This tells the server that all files have the .cgi and .pl extension are CGI programs. Of course you need to change all your CGI programs with .cgi or .pl extension.

But anyway, before start writting your own CGI program, come to see your web master first!

29-09-2006 06:19 AM
Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #2

RE: Introduction of CGI Porgramming


Thanks buddy,

Very good tutorials.


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
30-09-2006 12:29 AM
Find all posts by this user Quote this message in a reply
mastermind
Junior Member
*


Posts: 30
Group: Registered
Joined: Oct 2007
Status: Offline
Reputation: 0
Points: 35 (Donate)
Post: #3

RE: Introduction of CGI Porgramming


what are the different language to be used to run a cgi?

16-10-2007 03:14 PM
Find all posts by this user Quote this message in a reply
walsh
Senior Member
****


Posts: 401
Group: Registered
Joined: Oct 2006
Status: Offline
Reputation: 0
Points: 680 (Donate)
Post: #4

RE: Introduction of CGI Porgramming


mastermind Wrote:
what are the different language to be used to run a cgi?


You need a server that supports CGI.


16-10-2007 05:47 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Website of the Month

Create-a-Page for Free
SOTM June 2008


Accepting Submissions
for July 2008
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 07-09-2008, 07:04 AM


Copyright © 2002-2008 MyBB Group
Powered By MyBB