O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How CGI Works

A CGI script is a program, and most CGI programs are straightforward and written in C or Perl, two popular programming languages. Listing 28.1 shows a standard "Hello World" example in C.

Note

CGI programs are often called scripts because the first CGI programs were written using UNIX shell scripts (bash or sh) and Perl. Perl is an interpreted language, somewhat like a DOS batch file but much more powerful. When you execute a Perl program, the Perl instructions are interpreted and immediately compiled into machine instructions. Some other languages, such as C, are compiled ahead of time, and the resulting executable isn't normally called a script. Compiled programs usually run faster but are harder to modify.

In the CGI world, however, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required