iTP Secure WebServer System Administrator's Guide (iTPWebSvr 6.0+)
iTP Secure WebServer System Administrator’s Guide—523346-002
8-1
8
Using Common Gateway Interface 
(CGI) Programs
This section introduces you to using Common Gateway Interface (CGI) programs with 
the iTP Secure WebServer. Topics discussed in this section include:
•
CGI Support in the iTP Secure WebServer Environment on page 8-2
•
CGI Configuration and Programming on page 8-5
•
Configuring for CGI Programs on page 8-6
•
Passing CGI Environment Variables on page 8-11
•
HTTP Header Variables on page 8-21
•
Passing Input on page 8-24
•
Returning Output on page 8-26
•
Logging Error Information on page 8-29
•
CGI Standard File Environment on page 8-30
•
CGI Library on page 8-31
•
Pathway CGI Coding Considerations on page 8-33
•
Examples of a Pathway CGI Implementation on page 8-35
Web servers use CGI programs to interpret and process the information they receive 
from clients. CGI programs also interact with other programs and resources. For 
example, if a web client wishes to search a database, a CGI program would receive 
the search criteria (for example, keywords) from the web client as input and would then 
interact with the proper search mechanism to gather the information desired. The CGI 
program then would process this information for passing back to the web client through 
the server.
CGI programs can be written in several languages; the languages most often used are: 
Perl, Tcl, shell scripts (Korn or Bourne shell), C, and COBOL. Of these, HP offers C, 
C++, and Korn shell (through OSS) as supported products. The iTP Secure WebServer 
also lets you use Java servlets in a CGI execution environment.
When a server receives a request from a web client, the server runs the CGI program 
to process the request and uses either environment variables or standard input to pass 
request data to the program. The data passes to the CGI program through the 
Common Gateway Interface. After processing the request data, the CGI program uses 
standard output to pass requested objects or data to the server, which, in turn, passes 
the output to the web client. Figure 8-1 shows the relationships among the web client, 
a web server, the CGI, and a CGI program. 










