Question:

CGI is not a language! so what is it? is it a folder! I do not understand it?

by  |  earlier

0 LIKES UnLike

"CGI is not a language - it is an interface (in fact, the Common Gateway Interface). CGI is a standard for linking programming and scripting languages (C, Perl, etc.) to web servers. This allows, as you probably have seen, web sites to use dynamic content produced by other programs (and linked through CGI) rather than merely displaying static HTML pages."

My question is:

CGI is a standard for linking programming and scripting languages (C, Perl, etc.) to web servers.... Why do not we just use filename.pl or filename.php, etc....Why do we have to use .cgi while .php or .pl does the same role?

All i know about CGI, it is a folder that looks like 'cgi-bin'...!? is this the CGI we are talking about?

CGI = Common Gateway Interface! Where is the interface?

Please clarify to me, does not have to be an article, just say what you know....I hope you can help guys

 Tags:

   Report

4 ANSWERS


  1. It depends on the web server software you are using. CGI will let you run a program on the server and have the program's output sent back to the web site user. Obviously if you have a shell script or a PERL program, it has to be run by a shell interpreter or a PERL interpreter. How the web site user gets from a form posting or URL to your program depends on the web server software. So I think your confusion is just because of the way that particular server was setup.


  2. Having .php or .pl or whatever be recognized and executed by php or perl requires apache to have the php module or perl module installed. As I understand it, using CGI does not.

  3. It is - in the way you are referring to it - a file extension for a particular file type, just as .dll, .php. or .init is.

    By having that file extension, the file beomes usable by that interface, or in the case of .php, or .cs, by the compiler associated with it. It basically lets the OS know what program can be used to interpret or execute the file.

    Hope this helps.

  4. You do NOT have to use .cgi

    You can name the file whatever you want, as long as the webserver knows how to process it (i.e. execute it, as opposed to just sending its contents to the browser.  

    CGI is the specification of an Interface between a webserver and an executable program.  The webserver sends certain parts of the HTTP request to the program as command-line arguments.  The webserver sets certain values as environment variables visible to the program.  The webserver executes the program and sends its STDOUT to the browser.  

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.