Reply
Could someone explain what CGI is?
Old 08-21-2002, 11:44 AM Could someone explain what CGI is?
conkermaniac's Avatar
The Nutty Moderator

Posts: 1,012
Location: China
OK, here's something that I've never understood. What I do know about CGI (Common Gateway Interface) is that it isn't Perl nor is it a scripting language. I heard from the administrator of 9cy.net that you can't install "CGI' onto a server. He also told me that it was nothing more than a classification of many different languages. However, where I become confused is the dictionary definition. Webopedia defines it as "a protocol for transferring information between a "World Wide Web server and a CGI program". Now how does a server manager "get" CGI to convert the everday scripting language (C, Perl, Python) into a language that the server can understand, if he doesn't install anything?

Thanks for your responses. I'm going to bed (unless I become so overly addicted to this forum that I can't get off ).
__________________
Aimoo - Affordable feature-packed remotely hosted message boards!
conkermaniac is offline
Reply With Quote
View Public Profile Visit conkermaniac's homepage!
 
When You Register, These Ads Go Away!
     
Old 08-24-2002, 12:42 AM
conkermaniac's Avatar
The Nutty Moderator

Posts: 1,012
Location: China
I guess I'm not the only one who doesn't know.
__________________
Aimoo - Affordable feature-packed remotely hosted message boards!
conkermaniac is offline
Reply With Quote
View Public Profile Visit conkermaniac's homepage!
 
Old 08-24-2002, 12:49 AM
fonzerelli_79's Avatar
Webmaster Talker

Latest Blog Post:
11 Free Twitter Clients
Posts: 731
Location: Sunny Scotland
you know - i actually bought a cgi book over a year ago and i never actually sat down and learned anything - what a waste of £22.00 - probably out of date now too

though the book ive got is called cgi programming with perl
__________________
System0 | Blogging Tips
fonzerelli_79 is offline
Reply With Quote
View Public Profile Visit fonzerelli_79's homepage!
 
Old 08-24-2002, 02:41 AM
AhmedF's Avatar
Left for Better Places

Posts: 258
CGI = common gateway interface.

It is just an INTERFACE

so you can use C++ to program on the web too.

Basically, in very basics [heheh], it lets the server understand whatever programming language you are using. As perl was initially popular, people get confused with CGI and Perl being the same.

PHP on the otherhand is a parser, and is NOT CGI [even though you can build a CGI Version].

In fact, with CGI, you can even [possibly] program in QBasic!

Its a term you should not bother yourself with
AhmedF is offline
Reply With Quote
View Public Profile
 
Old 08-25-2002, 06:19 AM
Junior Talker

Posts: 4
Yes, CGI is an interface of sorts.
Actually it's protocol used by Web Servers to communicate with processes that the Web Server creates, which allows the Web Server to pass information to the process and with which the process can pass information back to the Web Server.

As AmhedF said, Perl was initally very popular for creating CGI programs, and that has led to the confusion that Perl and CGI are the same thing, when in fact they are very different.

Perl can be used to create CGI programs (programs that understand the CGI protocol), but it can also be used for a multitude of other programming tasks as well, most commonly Unix scripting and system admin.

But you can create CGI programs in any language that can utilise either Standard I/O or Shell variables (be it Unix shell or Windows cmd variables). What that means you can build CGI programs in C, C++, Perl, Java, Visual Basic, PHP, Unix Shell (bash, ksh, csh, any others), and probably many others.

Right, now lets take a step back. The Web Server gets the information to the program (in whichever language you choose) by one of two ways. It sets lots of environment variables (shell or cmd variables) which you program picks up, or it passes all the relevant information in the STDIN (standard input buffer) to your program. Then your program uses this data in whichever way it pleases, and then passes the data back to the Web Server as STDOUT (standard output buffer), using whatever equivalent of "print" the langauge uses.
Most langauges that are regularly used for CGI (perl, c, shell mainly) have very popular libraries of code which transform this input from the Web Server into some more manageable format. This is because when the data comes to the process (or program, or whatever you want to call it) the data is encrypted so that non ascii characters are put into their hex equivalents, ie. a space is %20, etc.

So a "server manager" (i assume you mean like web master, blokey that looks after the web server) doesn't ahve to do anything. The web server (if it supports cgi, many simple ones dont still) does all the hard work of knowing what programs to run based on the url you ask for, and then passes the info to that process, and gets the info back, and then passes that info back to the user (or web browser).

It's that simple

Hope that makes some sense for you.

regards,
Andy.
__________________
---------------------------------------
Ansa Solutions
World Class Software Development and Web Design
www.ansasolutions.co.uk
---------------------------------------
ansa is offline
Reply With Quote
View Public Profile Visit ansa's homepage!
 
Old 09-01-2002, 02:01 AM
Novice Talker

Posts: 7
Here's how I explain it to my clients:
CGI is a protocol established so that although many different programs used on the internet are in different programming languages, the protocol makes sure everybody understands each other when they need to. So, if you want something to happen, a script is written that will include all the instructions to make it happen. The script must meet the protocol established so that the server will understand what it is saying, so that it will happen.
babbsela is offline
Reply With Quote
View Public Profile
 
Old 09-12-2002, 06:42 PM
Tiggy's Avatar
Ultra Talker

Posts: 250
Location: Lancashire, UK
I have an article that asks that very question that I updated recently... not sure if it will help you but it might be worth a look.

http://websiteowner.info/articles/cgi/whatiscgi.asp

HTH
__________________
Web Site Owner's Resource - http://websiteowner.info
Tiggy is offline
Reply With Quote
View Public Profile Visit Tiggy's homepage!
 
Reply     « Reply to Could someone explain what CGI is?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.34656 seconds with 13 queries