Hack 83. Load a specific module only on demand

Sometimes you may not want to load all the modules in the Apache. For e.g. You may want to load ldap related modules to Apache, only when you are testing LDAP. This can be achieved as shown below.

Modify the httpd.conf and add IfDefine directive called load-ldap (you can name this anything you want).

LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

When you are testing ldap and would like to Load the ldap related modules, pass the load-ldap to Option -D, as shown below:

# httpd -k start -e debug -Dload-ldap -f /etc/httpd/conf/httpd.conf.debug

[Sun Aug 17 14:14:58 2008] [debug] mod_so.c(246): loaded module ldap_module
[Sun Aug 17 14:14:58 2008] [debug] mod_so.c(246): loaded module authnz_ldap_module
[Note: Pass -Dload-ldap, to load the ldap modules into Apache]

# apachectl start

Note: Start the Apache normally, if you don’t want to load the ldap modules.

Comments on this entry are closed.