HPlogo Configuring and Managing MPE/iX Internet Services > Chapter 9 HP WebWise MPE/iX Secure Web Server

Creating Apache Modules

MPE documents

Complete PDF
Table of Contents
Glossary
Index

E0802 Edition 6 ♥
E0701 Edition 5
E0400 Edition 4

DSOs should be written in the C Programming language. DSOs written in C must be compiled on MPE/iX.

Two ways that Apache module's can be created are:
  1. From a template, such as mod_example.c, or from an existing module.

  2. With the apxs utility.

A sample module, mod_hw, will be used to illustrate these two methods for creating a DSO module in C. The mod_hw structure is shown in Figure 9-1 Sample Module (mod_hw).

Figure 9-1 Sample Module (mod_hw)

[Sample Module (mod_hw)]

The mod_hw consists of two source files, mod_hw.c and hw.c. The file mod_hw.c contains the module structure and makes an external function call to pow() in the math library (/lib/libm). The mod_hw.c also makes an external function call to helloworld(), defined in hw.c. The output of mod_hw prints " Hello World" and also prints the result of raising 12 to the power of 2.

This module demonstrates how to build a DSO that calls external functions. Using mod_hw as an example, you will see how to compile and link an Apache module that calls an external function from an object file and calls an external function from a system library.

Note that modules are named mod_xxx.so by convention. To follow this convention, the sample module is called mod_hw.so.




Working with Dynamic Shared Objects (DSOs)


Tools