After all these years, is there any future on the Web for CGI -- the venerable Common Gateway Interface?
When first developed a decade ago, the World Wide Web was designed for displaying documents.
But almost from the start, Web site developers wanted a way to send data from a user's browser to a Web server -- for example, a user's name and password, or input for a search.
CGI offers a standardised way of providing that capability. When a user types data into a Web page form, the contents of the form are sent back to the Web server and fed through the CGI interface to a separate program for processing.
The CGI program can then send back to the user's Web browser an existing Web page, a new page generated on the fly, an image or any other kind of information that can be displayed on a browser.
Because CGI is so flexible, almost any program that can run on a Web server and accept command-line data can be used with CGI. Those include programs written in C, C++, Perl, Visual Basic and even Unix shell languages.
One major drawback with CGI is that it launches a new program each time a user clicks on a form, so Web servers used for heavily trafficked sites could be running thousands of programs at once -- a huge drain on Web-site performance.
Users also complain about programs written for CGI that aren't reusable as Web sites change, because those programs are frequently very specialised.
As a result, over the past several years, many large Web sites have phased out CGI in favour of application servers. Like CGI programs, application servers accept user input and send back Web pages or other information. But an application server processes many users' input with a single program, dramatically improving performance.
That doesn't mean an application server is for everyone. CGI is a nice fit for use on intranets, which usually have less traffic than external sites. That's a plus because departmental budgets generally don't support the $US15,000 to $100,000 price tag of an application server -- compared with CGI, which is built in to all Web servers.
CGI programs can be written in almost any language, and the CGI interface is very simple, so Web developers can quickly slap together simple CGI utilities.
That makes CGI a practical tool for emergency fixes and utilities that won't be heavily used on commercial Web sites.
"CGI is still very important," says Steve Robins, an analyst at The Yankee Group. "But there are increasingly more elegant ways, more sophisticated ways, to integrate with other systems."
Along with application servers, these other ways include Active Server Pages -- a generic application server built in to Microsoft's Internet Information Server Web server -- and Java servlets, which are small Java programs that run on a server.
"CGI is like a hammer," says Ray Valdes, an analyst at Gartner Group, "Large sites may have switched to power tools, but they still need a hammer for quick-and-dirty jobs."