Appendix B: Adding DSO Support to Apache


Introduction

Apache 1.3 introduced a method to dynamically load modules known as Dynamic Shared Objects (DSO) into a running Apache server. This support is available on most major platforms, including Linux and Solaris. DSO support often makes it easier to load additional modules into the Apache web server at a later time without having to recompile the entire server. In addition, many third-party modules are distributed in pre-compiled DSO formats which just need to be inserted into the server.


Enabling DSO Support

In order to enbale DSO support, simply add the following directive when configuring Apache (or add it to the config.status file):

--enable-module=so
On most platforms this is enough to enable DSO support. Some platforms will also require the following option which will cause most of the code which normally comprises the Apache binary to be compiled into a DSO module, libhttpd.so.
--enable-rule=SHARED_CORE
Finally, to cause most of the standard Apache modules which are not required to actually bootstrap the server to be compiled as DSOs, use the following option:
--enable-shared=max
Optionally, --enable-shared can be used in conjunction with --enable-module to enable individual modules and compile them as DSO modules.


More Information

For more information,including a discussion on the pros and cons of using dynamic shared objects, please see the DSO page in the Apache documentation at http://www.apache.org/docs/dso.html.

A common problem crops up while trying to compile DSO modules using apxs--the command will fail giving the following error message:

apxs:Break: Command failed with rc=16711680
This is due to apxs not being properly built when Apache is configured. The PHP FAQ has an excellent discussion of this and how to resolve it. The article can be found at http://www.php.net/FAQ.php#6.11.