1005N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1005N/A <
TITLE>Apache module mod_example</
TITLE>
1005N/A <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 1005N/A <
H1 ALIGN="CENTER">Module mod_example</
H1>
1005N/A This module illustrates many of
1005N/A and, when used, demonstrates the manner in which module callbacks are
1005N/A><
STRONG>Status:</
STRONG></
A> Extension
><
STRONG>Module Identifier:</
STRONG></
A> example_module
><
STRONG>Compatibility:</
STRONG></
A> Available in Apache 1.2 and later.
Apache distribution directory tree are provided as an example to those
that wish to write modules that use the Apache API.
The main file is <
CODE>
mod_example.c</
CODE>, which illustrates all
the different callback mechanisms and call syntaxes. By no means does
an add-on module need to include routines for all of the callbacks -
The example module is an actual working module. If you link it into
your server, enable the "example-handler" handler for a location, and
then browse to that location, you will see a display of
some of the tracing the example module did as the various callbacks
<
LI><
A HREF="#example">Example</
A>
<
h2>Compiling the example module</
h2>
To include the example module in your server, follow the steps below:
it; it should look like this:
("<
SAMP>cd src; /
Configure</
SAMP>"). This will
build the Makefile for the server itself, and update the
have requested from beneath that subdirectory.
<
LI>Make the server (run "<
SAMP>make</
SAMP>" in the <
CODE>src</
CODE>
To add another module of your own:
<
LI><
SAMP>mkdir
src/
modules/<
EM>mymodule</
EM></
SAMP>
<
LI>Modify the files in the new directory.
<
LI>Follow steps [1] through [3] above, with appropriate changes.
Using the <
SAMP>mod_example</
SAMP> Module
To activate the example module, include a block similar to the
following in your <
SAMP>
srm.conf</
SAMP> file:
<Location /example-info>
SetHandler example-handler
As an alternative, you can put the following into a
><
SAMP>.htaccess</
SAMP></
A>
file and then request the file "
test.example" from that
AddHandler example-handler .example
to this location and see the brief display mentioned earlier.
><
STRONG>Syntax:</
STRONG></
A> Example
><
STRONG>Default:</
STRONG></
A> None
><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory,
><
STRONG>Override:</
STRONG></
A> Options
><
STRONG>Status:</
STRONG></
A> Extension
><
STRONG>Module:</
STRONG></
A> mod_example
><
STRONG>Compatibility:</
STRONG></
A> <
SAMP>Example</
SAMP> is only
available in Apache 1.2 and later.
The <
SAMP>Example</
SAMP> directive just sets a demonstration flag which the
example module's content handler displays. It takes no arguments. If you
browse to an URL to which the example content-handler applies, you will get
a display of the routines within the module and how and in what order they
were called to service the document request. The effect of this directive
one can observe under the point "<
SAMP>Example directive declared