Hack 83. Load a specific module only on demand

by Ramesh

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).

  1. LoadModule ldap_module modules/mod_ldap.so
  2. LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  3.  

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

  1. # httpd -k start -e debug -Dload-ldap -f /etc/httpd/conf/httpd.conf.debug
  2.  
  3. [Sun Aug 17 14:14:58 2008] [debug] mod_so.c(246): loaded module ldap_module
  4. [Sun Aug 17 14:14:58 2008] [debug] mod_so.c(246): loaded module authnz_ldap_module
  5. [Note: Pass -Dload-ldap, to load the ldap modules into Apache]
  6.  
  7. # apachectl start

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