CGI Environment Variables

CGI programs receive information in a variety of forms. One of the most useful of these forms is the set of CGI environment variables. Based on the contents of these variables, a CGI program can make meaningful decisions regarding how best to interact with the Web client that invoked the CGI program.

CGI environment variables are provided to the CGI program by the parent Web server process. The server creates these variables using information derived from three different sources:

  • The incoming HTTP request. This provides REMOTE_ADDR information.

  • The Web server program itself. For instance, the SERVER_SOFTWARE variable is provided by the Web server.

  • The HTTP request header provided to the Web server by the Web client. For ...

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.