How CGI Programs Work

Now I’m ready to get down to the nuts and bolts of how CGI programs work. The great thing about CGI is that it’s an extremely simple interface. If you’re familiar with UNIX-based operating systems, you will recognize the concepts that CGI is grounded in.

As I’ve already discussed, CGI is a set of conventions that allows Web servers and external programs to communicate. To illustrate how CGI programs work, I’m going to include a description of the entire HTTP session, so you can understand at a high level how it all fits together.

How Resources Are Requested

An HTTP session is initiated when a Web client (usually a Web browser) requests a resource from a Web server. As I’m sure you already know, these resources are identified ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.