Search | Directories | Reference Tools
UW Home > UWIN > Computing and Networking > Web > Web Publishing > Using CGI Programs 

An Introduction to CGI

Summary

The Common Gateway Interface (CGI) defines how a Web server can invoke other programs, known as CGI programs, and use these programs to create essentially more interactive Web sites. This article only provides background information on CGI. CGI program developers should refer to Developing CGI Programs for further details about using CGI programs on UW Technology's Web servers.

Included on this page:

What is CGI anyway?

CGI is a simple interface built into Web servers to make them more flexible. CGI allows a Web server to invoke other programs, called CGI programs or CGI scripts, and use these programs to generate dynamic responses. Web developers often use CGI programs to process online forms or generate Web pages on-the-fly.

What is a CGI program?

First and foremost, a CGI program is a computer program, written in a programming language. Because of this, writing and editing CGI programs is inherently more problematic than writing Web pages in HTML. You can't, for example, edit a CGI program without some risk of completely breaking it.

A CGI program resides on a Web server and behaves according to the rules of CGI. Unlike most files in your Web directory, a CGI program is invoked when it is requested by a Web browser. The results of executing the CGI program, not the CGI program itself, are passed along as the content of the response.

Do I have to write my own CGI programs?

Not necessarily. You can download and install CGI programs without having to write anything. This requires other skills, such as Unix skills, as well as an understanding of the local CGI programming environment. UW Technology does not install, support, or help fix CGI programs found at large. There are too many of them and too few of us.

Do CGI programs raise any security issues?

Unfortunately they do. If you use CGI programs you may accidentally allow someone to snoop through, remove, or even modify the files in your Web directory. When you install someone else's CGI program, you are trusting the author's competence and good intentions. If you write your own CGI program, you are trusting your own competence and good intentions. Be careful.

Send email to help@u.washington.edu if you have any questions about writing secure CGI programs.