Contents
CGI
An acronym for Common Gateway Interface, CGI is an interface program that enables an Internet server to run external programs to perform a specific function.
Also referred to as gateways or CGI “scripts,” these programs generally consist of a set of instructions written in a programming language like C or PERL that process requests from a browser, execute a program and format the results in HTML so they can be displayed in the browser.
Gateway scripts are commonly used to add interactivity to a web page by allowing users to do things like fill out and submit forms for processing (as in an order form for an online catalog); query databases by submitting search requests; and register or gain access to password-protected areas of a site. CGI scripts are also used to implement a variety of tracking and measurement systems on a website.
Also See: Forms
Frequently Asked Questions
Why do websites need special scripts?
When you visit a traditional website, your browser contacts the page’s server and then downloads the contents to your computer to display on your screen, rather like opening a book and holding it up for you to read. CGI scripts allow web servers to send interactive applications back as well. So instead of just getting a static page, you can now get a website with special sections just for you—which you need to register to view—or places for you to provide feedback, or even the ability to chat with other visitors or upload your own content to the page.
Gateway scripts also provide consistency across different types operating systems and programming languages. When you install a program to your computer, it was written specifically for your operating system, and would be useless on any other operating system. Information on the Web, on the other hand, needs to be compatible with all types of systems. When your browser accesses a website, it reads the HTTP files and interprets the contents to display information to your screen. When you add executable applications, those could be running on a Linux, Windows, or any other type of server, so the HTTP needs a way to speak to programs installed on any of those systems. CGI scripts allow them to do so. The consistency of scripts also means programmers can utilize a variety of languages when designing the application, and the server will still be able to interpret it.
Are there alternatives to CGI?
There are a number of new technologies available for creating dynamic web pages. Some of the most popular include PHP, Micrsoft’s ASP.NET, and Adobe’s ColdFusion. Each solution involves its own standards and server requirements, but all are designed to provide seamless interaction between your web server and your visitor’s web browser.