Introduction of CGI | What is Common Gateway Interface (CGI)?

cgi-introduction

cgi-introduction

Any Server will (mostly) do   

  • CGI will not work without a server
  • Your Server must allow CGI
  • Your CGI application must be written in a language supported by your server
  • You can use probably your existing web server
  • If you need to test on your local computer, you may install WAMP/XAMPP
  • Each Server has a particular requirements about running  CGI Applications

Prerequisties
Experience in relevant programming language

  • Perl
  • Php
  • Unix Shell
  • c/c++
  • HTML/CSS

What is CGI
Common Interface Gateway

  • How web browsers submit forms and interact with programs on the server
  • Used for simple interaction applications
  • Can be used with any programming language
  • Often called “CGI Scripts”
  • Can be written in any language
  • Run in the server, not in a web browser
  • Must follow server requirements for running applocations

ANY SERVER WILL (MOSTLY) do

  • CGI will not work without a web server
  • Your Server must allow CGI
  • Your CGI application must be written in a language supported by your server
  • You can use  your existing web server
  • If you need to test on your local computer, you may install WAMP/XAMPP

Some Guidelines for Unix/Apapche users

  1. Permission – 755 ( aka rwxr-xr-x)
  2. Filename associates
  3. .cgi, .pl, .php …etc
  4. .httaccess
  5. Options+ExecCGI
  6. AddHandle cgi-scripts .cgi
  7. SetHander cgi-script
  8. Access to server log

Some Guidelines for Windows Servers
Many Windows servers do not support perl or PHP
May require ASP or C#
Usually require specific filename extension
.pl for perl
.php for php
.asp or .aspx for ASP
Access to error log
Check with your server web site or support staff

How CGI works

  1. Browser Communicates with server over HTTP
  2. Browser sends a request to the server consisting of header and optional body
  3. Server sends information to the CGI application
  4. Environment variables
  5. Body may be sent in the STDIN stream
  6. Server sends a response consisting of a header and a body
Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x