CGI, Common Gateway Interface is a standard protocol for interfacing external application software with an information server, commonly a HTTP or web server.
A plain HTML document that the Web server delivers is static, which means it doesn't change. A CGI program, on the other hand, is executed in real-time, so that it can output dynamic information - perhaps a weather reading, or the latest results from a database query.
A Common Gateway Interface (CGI) program can be written in any language that allows it to be executed on a computer. The most commonly used languages for CGI at present is Perl.
Server side scripts (like CGI) may be called from the client with a HTML file reference to the server side script in any of the following ways:
- An HTML Anchor tag reference
- A SSI (Server side include) tag reference
- Using the HTML FORM tag with the action attribute set to the location and name of the server side script.
Some CGI Applications
1. Forms: One of the most prominent uses of CGI is in processing forms. Forms can be used to collect information from the user. They can also be used in a more complex manner to provide back-and-forth interaction. A CGI program can process this type of information.
2. Web Gateways are programs or scripts used to access information that is not directly readable by the client. For example, say you have an MySQL database that contains cricket statistics for all the players in team and you would like to provide this information on the Web. How would you do it? You certainly cannot point your client to the database file. CGI provides a solution to the problem in the form of a gateway. You can use a language such as perl to form SQL queries to read the information contained within the database.
article continued below..........