Setting up CGI programs for HTTP Server

This topic provides information about how to set up CGI programs for your IBM® HTTP Server for i Web server.

You can extend the capability of the HTTP Server by adding CGI programs. The HTTP Server supports Integrated Language Environment (ILE) CGI programs and AIX CGI programs.

Here is a summary of the steps you need to take to enable your server to run CGI programs:

1. Create the CGI program.

ILE CGI programs can be written in ILE C/C++, ILE RPG, or ILE COBOL programming languages. The HTTP Server provides CGI application programming interfaces in support of ILE CGI programming.

In addition to support for ILE CGI programs, the HTTP Server has the ability to run REXX programs and AIX programs as CGI programs. For more information about running AIX CGI programs, see Running CGI programs in IBM PASE for i.

2. Move the CGI program to the CGI directory.

ILE CGI programs must reside in the QSYS.LIB file system. REXX CGI programs must reside in database files named REXX or QREXSRC. AIX CGI programs must reside in the QOpenSys file system.

3. Ensure that your program has the correct authority using *PUBLIC, QTMHHTTP or QTMHHTP1.

If the UserID directive is not active, the server profile QTMHHTP1 needs access to the CGI program and all objects the program accesses. If the UserID directive is active, the UserID profile needs access to the CGI program and all objects the program accesses.

4. Make changes to the HTTP Server configuration file.

For example, you need to add the ScriptAlias directive at a minimum.
Note: For REXX programs, you only need to indicate the path and the file name in the ScriptAlias directive. For example:
ScriptAlias /REXX /QSYS.LIB/AS400CGI.LIB/QREXSRC.FILE/*

The URL is :

http://hostname/REXX/samplecgi.REXX