Overview of the Apache TPF Port


[ Configuration Files | What's Available | CGI Scripts | Options | Syslog | Porting Notes ]

Apache includes changes allowing it to run on IBM's EBCDIC-based TPF (Transaction Processing Facility) operating system. This builds on the EBCDIC changes previously made to Apache.

Refer to either the TPF4.1 installation or z/TPF1.1 installation documents for step-by-step build instructions.

If you would like to be notified when new versions of Apache are released consider joining the announcements list.


Apache Configuration Files

Directives

The distributed configuration files (httpd.conf-dist and mime.types, both located in the conf subdirectory) work on TPF with the following caveats:

Restart

Unlike on Unix systems, newly created Apache child processes on TPF re-read the various configuration files (such as httpd.conf and mime.types).
Therefore when you change the configuration file(s) you should manually restart the server to keep the Apache parent process and all child processes in sync. There are several ways to restart Apache on TPF:

Apache documentation details Stopping and Restarting Apache.

Please see the Spring 2006 TPFUG Apache presentation (in the Open Source section) for TPF diagrams and additional information on start, stop, and restart.


What's Available in this Version

Unless otherwise noted either TPF4.1 PUT09 or z/TPF1.1 is required for the server to function on TPF.

The Apache organization provides online documentation describing the various modules and components of the server.

Components/modules tested on TPF:

Components/modules not yet supported on TPF:

Components/modules that don't apply or that probably won't ever be available on TPF:


How to Use CGI Scripts

The following is a very simple example of a CGI script ("Hello World") and the necessary steps to run it.
Refer to the mod_cgi module for additional information.

Add necessary directives to httpd.conf:

Example:

ScriptLog logs/script_log
ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/

A request for http://myserver/cgi-bin/filename.cgi would cause the server to run the script /usr/local/apache/cgi-bin/filename.cgi

Create the CGI script:

For this example QZZ1 is the name of the TPF program that will be executed by the CGI script.
The directory path must match what is in the httpd.conf file for ScriptAlias directive.

zfile echo "#!QZZ1" > /usr/local/apache/cgi-bin/filename.cgi
zfile cat /usr/local/apache/cgi-bin/filename.cgi    
(expected output: #!QZZ1)

Mark the script as executable:

zfile chmod 755 /usr/local/apache/cgi-bin/filename.cgi

Create, load, and activate the CGI program (QZZ1) on TPF:

/* QZZ1-- simple "Hello world" program to demonstrate basic CGI output */

#include <stdio.h>
#include <stdlib.h>

int main() {

   /* Print the CGI response header, required for all HTML output. */
   /* Note the extra \n, to send the blank line.                   */
   /* Print the HTML response page to STDOUT.                      */
   printf("Content-type: text/html\n\n");

   printf("<html>\n");
   printf("<head><title>CGI Output</title></head>\n");
   printf("<body>\n");
   printf("<h1>Hello world.</h1>\n");
   printf("</body>\n");
   printf("</html>\n");

   exit(0);
}

Request the CGI script from a browser:

http://myserver/cgi-bin/filename.cgi


How to Use Apache's "Dash" Options

Overview of Apache's "dash" options:

Apache can be invoked with various options, such as "-f". Some of these options display information about the server or perform syntax checks but they don't actually start the server. These "information only" options are useful with TPF's ZFILE command line feature: -h, -l, -L, -S, -t, -T, -v, and -V.

Another option, -X, is used when actually running the server. It is passed to Apache through the ZINET XPARM field since ZINET is the only way to start the server on TPF.

A third group of options apply to both the informational displays (ZFILE) and running the server (ZINET XPARM): -d, -D and -f.

The rest of Apache's options are either not applicable or are not supported on TPF.

On TPF4.1 using dash options requires PJ27277 which shipped on PUT13.

Table of supported Apache options

Option         ZFILE ZINET Description
-d path ZFILE ZINET Set the initial value for the ServerRoot directive.
-D define ZFILE ZINET Set a configuration parameter which can be used with <IfDefine>...</IfDefine> sections in the configuration file to conditionally skip or process commands.
-f filename ZFILE ZINET Use an alternate configuration file instead of the default conf/httpd.conf file.
-h ZFILE   List a short summary of available command line options then exit. Note that this outputs all options, not just those supported on TPF.
-l ZFILE   List modules compiled into the server then exit.
-L ZFILE   List available configuration directives then exit. Note that this outputs all configuration directives, not just those supported on TPF.
-S ZFILE   Show the settings as parsed from the configuration file then exit. Currently Apache only shows the virtual host settings.
-t ZFILE   Run syntax tests for configuration files with document root checks then exit.
-T ZFILE   Run syntax tests for configuration files without document root checks then exit.
-v ZFILE   Show the version number then exit.
-V ZFILE   Show the version number and various compile settings then exit.
-X   ZINET Run in single-process mode for internal debugging purposes only. The parent process does not tpf_fork any children.

See http://httpd.apache.org/docs/programs/httpd.html for more information about these command line options.

Setup for ZFILE examples:

Ensure Apache (CHTA) is loaded.

Create the httpd script:

zfile echo "#!CHTA" > /bin/httpd
zfile cat /bin/httpd  
(expected output:  #!CHTA)

(See "ZFILE-Activate a TPF Segment or Script" in the IBM TPF Information Center for additional information.)

Mark the script as executable:

zfile chmod 755 /bin/httpd

ZFILE example 1:

zfile httpd -v

FILE0001I 11.43.09 START OF DISPLAY FROM httpd -v
Server version: Apache/1.3.20 (TPF)
Server built: May 23 2001 09:39:22
END OF DISPLAY

ZFILE example 2:

zfile httpd -t -f /usr/local/apache/conf/alt.conf

FILE0002I 11.47.26 START OF ERROR DISPLAY FROM httpd -t ...
Syntax OK
END OF DISPLAY

ZINET XPARM example:

This example uses an alternate configuration file called /usr/local/apache/conf/alt.conf.

Create and transfer your alternate configuration file to your TPF test system.

Add and start Apache using ZINET commands:

zinet add s-apache pgm-chta model-daemon user-root xparm--f conf/alt.conf
zinet start s-apache

(See "ZINET ADD-Add an Internet Server Application Entry" and "ZINET ALTER-Change an Internet Server Application Entry" in the IBM TPF Information Center for more information about using the XPARM field.)


Syslog Daemon

Syslog overview:

The syslog daemon is a server process that provides a message logging facility for application and system processes. It can be used to write messages to log files or to tapes. See "Operating the Syslog Daemon" in the IBM TPF Information Center. And see the Apache ErrorLog directive documentation for details on how to use syslog with Apache.

On TPF4.1 syslog capabilities were added with PJ27214 which shipped with PUT13. You must follow the TPF4.1 syslog-specific installation instructions in order to have the option of using syslog with Apache on a TPF4.1 system. No additional installation steps are needed for z/TPF1.1 systems.

Tips on using syslog with your Apache error log:

This section provides some tips on using syslog with Apache. It is not meant to replace the syslog documentation in the TPF TCP/IP publication.


Porting Notes

Changes made due to differences between UNIX and TPF's process models:



[ top | Configuration Files | What's Available | CGI Scripts | Options | Syslog | Porting Notes ]