Manual Pages for UNIX Darwin command on man apxs
MyWebUniversity

Manual Pages for UNIX Darwin command on man apxs

apxs(8) apxs(8)

NAME

apxs - APache eXtenSion tool

SYNOPSIS

aappxxss -gg [ -SS variable=value ] -nn name

aappxxss -qq [ -SS variable=value ] query ...

aappxxss -cc [ -SS variable=value ] [ -oo dsofile ] [ -II incdir ] [ -DD vari-

able[=value] ] [ -LL libdir ] [ -ll libname ] [ -WWcc,,compiler-flags ] [

-WWll,,linker-flags ] files ...

aappxxss -ii [ -SS variable=value ] [ -nn name ] [ -aa ] [ -AA ] dsofile ...

aappxxss -ee [ -SS variable=value ] [ -nn name ] [ -aa ] [ -AA ] dsofile ...

DESCRIPTION

aappxxss is a tool for building and installing extension modules for the Apache HyperText Transfer Protocol (HTTP) server. This is achieved by building a Dynamic Shared Object (DSO) from one or more source or

object files which then can be loaded into the Apache server under run-

time via the LLooaaddMMoodduullee directive from mmooddssoo.. So to use this extension mechanism, your platform has to support the DSO feature and your Apache hhttttppdd binary has to be built with the mmooddssoo module. The aappxxss tool automatically complains if this is not the case. You can check this yourself by manually running the command

$ httpd -l

The module mmooddssoo should be part of the displayed list. If these requirements are fulfilled, you can easily extend your Apache server's functionality by installing your own modules with the DSO mechanism by the help of this aappxxss tool:

$ apxs -i -a -c modfoo.c

gcc -fpic -DSHAREDMODULE -I/path/to/apache/include -c modfoo.c

ld -Bshareable -o modfoo.so modfoo.o

cp modfoo.so /path/to/apache/libexec/modfoo.so chmod 755 /path/to/apache/libexec/modfoo.so [activating module `foo' in /path/to/apache/etc/httpd.conf]

$ apachectl restart

/path/to/apache/sbin/apachectl restart: httpd not running, trying to start [Tue Mar 31 11:27:55 1998] [debug] modso.c(303): loaded module foomodule /path/to/apache/sbin/apachectl restart: httpd started

$

The arguments files can be any C source file (.c), a object file (.o) or even a library archive (.a). The aappxxss tool automatically recognizes

these extensions and automatically uses the C source files for compila-

tion while it just uses the object and archive files for the linking

phase. But when using such pre-compiled objects, make sure they are

compiled for Position Independend Code (PIC) to be able to use them for

a DSO. For instance with GCC you always just have to use -ffppiicc. For

other C compilers please consult its manual page or watch for the flags aappxxss uses to compile the object files. For more details about DSO support in Apache, first read the background

information about DSO in htdocs/manual/dso.html, then read the documen-

tation of mmooddssoo. OOPPTTIIOONNSS Common options:

-nn name This explicitly sets the module name for the -ii (install)

and -gg (template generation) option. Use this to explicitly

specify the module name. For option -gg this is required,

for option -ii the aappxxss tool tries to determine the name

from the source or (as a fallback) at least by guessing it from the filename. Query options:

-qq Performs a query for aappxxss's knowledge about certain set-

tings. The query parameters can be one or more of the fol-

lowing variable names: CC TARGET CFLAGS SBINDIR CFLAGSSHLIB INCLUDEDIR LDSHLIB LIBEXECDIR LDFLAGSSHLIB SYSCONFDIR LIBSSHLIB PREFIX Use this for manually determining settings. For instance use

INC=-I`apxs -q INCLUDEDIR`

inside your own Makefiles if you need manual access to Apache's C header files. Configuration options:

-SS variable=value

This option changes the aappxxss settings described above. Template Generation options:

-gg This generates a subdirectory name (see option -nn) and

there two files: A sample module source file named mmooddname.c which can be used as a template for creating your own modules or as a quick start for playing with the

aappxxss mechanism. And a corresponding MMaakkeeffiillee for even eas-

ier building and installing of this module. DSO compilation options:

-cc This indicates the compilation operation. It first compiles

the C source files (.c) of files into corresponding object files (.o) and then builds a DSO in dsofile by linking these object files plus the remaining object files (.o and

.a) of files If no -oo option is specified the output file

is guessed from the first filename in files and thus usu-

ally defaults to mmooddname.so

-oo dsofile Explicitly specifies the filename of the created DSO file.

If not specified and the name cannot be guessed from the files list, the fallback name mmoodduunnkknnoowwnn..ssoo is used.

-DD variable[=value]

This option is directly passed through to the compilation command(s). Use this to add your own defines to the build process.

-II incdir This option is directly passed through to the compilation

command(s). Use this to add your own include directories to search to the build process.

-LL libdir This option is directly passed through to the linker com-

mand. Use this to add your own library directories to search to the build process.

-ll libname This option is directly passed through to the linker com-

mand. Use this to add your own libraries to search to the build process.

-WWcc,,compiler-flags

This option passes compiler-flags as additional flags to

the compiler command. Use this to add local compiler-spe-

cific options.

-WWll,,linker-flags

This option passes linker-flags as additional flags to the

linker command. Use this to add local linker-specific

options. DSO installation and configuration options:

-ii This indicates the installation operation and installs one

or more DSOs into the server's libexec directory.

-aa This activates the module by automatically adding a corre-

sponding LLooaaddMMoodduullee line to Apache's hhttttppdd..ccoonnff configura-

tion file, or by enabling it if it already exists.

-AA Same as option -aa but the created LLooaaddMMoodduullee directive is

prefixed with a hash sign (#), i.e. the module is just pre-

pared for later activation but initially disabled.

-ee This indicates the editing operation, which can be used

with the -aa and -AA options similarly to the -ii operation to

edit Apache's hhttttppdd..ccoonnff configuration file without attempting to install the module. EEXXAAMMPPLLEESS Assume you have an Apache module named modfoo.c available which should extend Apache's server functionality. To accomplish this you first have to compile the C source into a DSO suitable for loading into the Apache server under runtime via the following command:

$ apxs -c modfoo.c

gcc -fpic -DSHAREDMODULE -I/path/to/apache/include -c modfoo.c

ld -Bshareable -o modfoo.so modfoo.o

$

Then you have to update the Apache configuration by making sure a LLooaadd-

MMoodduullee directive is present to load this DSO. To simplify this step aappxxss provides an automatic way to install the DSO in the "libexec" directory and updating the hhttttppdd..ccoonnff file accordingly. This can be achieved by running:

$ apxs -i -a modfoo.c

cp modfoo.so /path/to/apache/libexec/modfoo.so chmod 755 /path/to/apache/libexec/modfoo.so [activating module `foo' in /path/to/apache/etc/httpd.conf]

$

This way a line named LoadModule foomodule libexec/modfoo.so is added to the configuration file if still not present. If you want

to have this operation to be disabled, use the -AA option, i.e.

$ apxs -i -A modfoo.c

For a quick test of the aappxxss mechanism you can create a sample Apache module template plus a corresponding MMaakkeeffiillee via:

$ apxs -g -n foo

Creating [DIR] foo Creating [FILE] foo/Makefile Creating [FILE] foo/modfoo.c

$

Then you can immediately compile this sample module into a DSO and load it into the Apache server:

$ cd foo

$ make all reload

apxs -c modfoo.c

gcc -fpic -DSHAREDMODULE -I/path/to/apache/include -c modfoo.c

ld -Bshareable -o modfoo.so modfoo.o

apxs -i -a -n "foo" modfoo.so

cp modfoo.so /path/to/apache/libexec/modfoo.so chmod 755 /path/to/apache/libexec/modfoo.so [activating module `foo' in /path/to/apache/etc/httpd.conf] apachectl restart /path/to/apache/sbin/apachectl restart: httpd not running, trying to start [Tue Mar 31 11:27:55 1998] [debug] modso.c(303): loaded module foomodule /path/to/apache/sbin/apachectl restart: httpd started

$

You can even use aappxxss to compile complex modules outside the Apache source tree, like PHP3, because aappxxss automatically recognized C source files and object files.

$ cd php3

$ ./configure -with-shared-apache=../apache-1.3

$ apxs -c -o libphp3.so modphp3.c libmodphp3-so.a

gcc -fpic -DSHAREDMODULE -I/tmp/apache/include -c modphp3.c

ld -Bshareable -o libphp3.so modphp3.o libmodphp3-so.a

$

Only C source files are compiled while remaining object files are used for the linking phase.

SEE ALSO

aappaacchheeccttll((11)),, hhttttppdd((88))..

February 2004 apxs(8)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™