Is CGI Dead?
By Lincoln D. Stein
In this "back to basics" issue of Web Techniques it seems appropriate to look back at the Common Gateway Interface (CGI) protocol and take stock. Six years ago (almost an eternity in Web terms) CGI's package of rules and programming conventions revolutionized the embryonic Web, turning boring, static HTML documents into exciting, dynamic documents, and, as a side effect, catapulting Perl from an obscure UNIX sysadmin's scripting language into a well-respected software development tool.
Without having exact statistics (which are impossible to derive), it's fair to say that static HTML files account for a minority of the documents on the Web, dwarfed by the infinite variations on dynamic pages emitted by search engines, database interfaces, news gateways, media outlets, and more specialized programs. All these dynamic pages are driven by software wired either directly or indirectly into a Web server. A significant fraction, possibly the majority, of these programs use the CGI protocol.
But CGI is an archaic technology. It's heavily tied to assumptions about the UNIX operating system, particularly about using environment variables. The protocol is inefficient because it requires a new process to be respawned each time a page is served. Furthermore, the protocol is severely limited in scope because it restricts scripts to interacting with the Web server during the content-generation phase of the transaction and does not allow scripts to intervene in other interesting operations, such as user authentication and URL-to-filename translation.