Internet
Fact-checked

At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is the Common Gateway Interface?

Mary Elizabeth
Mary Elizabeth
Mary Elizabeth
Mary Elizabeth

In the realm of computers, a gateway can be several things, including a node that physically connects disparate networks, converting their protocols so they can communicate, or a functional service that provides an intermediary between multiple systems. Gateway programs can act as gateways between server-side resources — like databases — and the web. The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and these server-side gateway programs, and was used by most servers to process client requests that required server-side data processing. It is a standard, as well as an interface.

The Common Gateway Interface works in two directions. Suppose that a user sends a request through a web browser, such as submitting an HTML form with data in order to be added to a mailing list. The HTTP server can only serve documents, not process the data. So once the HTTP (HyperText Transfer Protocol) of data to the server is complete, the Common Gateway Interface conveys the data from the server to the gateway program that connects to the database. The results of the processing, such as a confirmation message, are returned to the user traveling on the path in reverse: from the database to the gateway program through the Common Gateway Interface to the server, through HTTP to the user’s web browser.

The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and server-side gateway programs.
The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and server-side gateway programs.

A Common Gateway Interface script is the name of the software program that was used to process a query to a database. It had the benefit of being operating system agnostic, meaning it would work on a server no matter which operating system it was running. While CGI was much used in the early days of the web, there are now newer, more efficient server-side methods for processing queries, and these are now found as well. These include ASP (Active Server Page) and its newer version ASP.NET (Active Server Page for dot-net, also known as ASP+) and JSP® (JavaServer Page), which allows the combination of HTML (HyperText Markup Language) and Java to work smoothly together on a single web page, but note that ASP is made by Microsoft® and only runs on Microsoft® web servers.

A Common Gateway Interface script is the name of the software program that was used to process a query to a database.
A Common Gateway Interface script is the name of the software program that was used to process a query to a database.

CGI itself has also developed. FastCGI™, an open standard, language-independent extension of CGI that allows for distributed computing, and — unlike CGI — does not exit after each request is complete, but persists, waiting for the next request. SCGI (Simple CGI) is another alternative, both a protocol and a program, placed in the public domain by its creator.

Mary Elizabeth
Mary Elizabeth

Mary Elizabeth is passionate about reading, writing, and research, and has a penchant for correcting misinformation on the Internet. In addition to contributing articles to EasyTechJunkie about art, literature, and music, Mary Elizabeth is a teacher, composer, and author. She has a B.A. from the University of Chicago’s writing program and an M.A. from the University of Vermont, and she has written books, study guides, and teacher materials on language and literature, as well as music composition content for Sibelius Software.

Learn more...
Mary Elizabeth
Mary Elizabeth

Mary Elizabeth is passionate about reading, writing, and research, and has a penchant for correcting misinformation on the Internet. In addition to contributing articles to EasyTechJunkie about art, literature, and music, Mary Elizabeth is a teacher, composer, and author. She has a B.A. from the University of Chicago’s writing program and an M.A. from the University of Vermont, and she has written books, study guides, and teacher materials on language and literature, as well as music composition content for Sibelius Software.

Learn more...

Discuss this Article

Post your comments
Login:
Forgot password?
Register:
    • The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and server-side gateway programs.
      By: .shock
      The Common Gateway Interface (CGI) was the initial mechanism that served as a generic interface between the server and server-side gateway programs.
    • A Common Gateway Interface script is the name of the software program that was used to process a query to a database.
      By: rh2010
      A Common Gateway Interface script is the name of the software program that was used to process a query to a database.