Some one posted about, "What is Modules in Linux and how to add it in apache," on our forum. Therefore, I decided to create a small howto for adding new modules under Apache. The Apache HTTP Server is a modular program. So as a UNNIX/Linux administrator you can choose the functionality to include in the server by selecting a set of modules (or features via modules).
A module provides variety of features for apache such as security, perl and php support etc. To configure apache for additional modules you need to add LoadModule directive in httpd.conf or modules.conf file. For example you can add session management and tracking through consistent identifiers using mod_session. You need to add following entry to Apache 1.3.xx server (under Debian Linux you need to add to /etc/apache-perl/modules.conf file):
LoadModule auth_module /usr/lib/apache/1.3/mod_session.so
Please note that your Apache server must configure for Dynamic Shared Objects (DSOs). Let us assume you have downloaded the module called mymodule.c and you would like to compile and use this module, then you can use Apache apxs utility to compile and install this module:
Build and install a third-party Apache module, say mod_foo.c, into its own DSO mod_foo.so outside of the Apache source tree using apxs:
# apxs -c mymodule.c # apxs -i -a -n mymodule mymodule.la
Then open your httpd.conf file and add mymodule using top LoadModule Directive:
# vi httpd.conf
Append following line to server config context (this means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any or containers. It is not allowed in .htaccess files at all).
LoadModule mymodule /usr/lib/httpd/modules/mymodule.so
If you are a Web developer then do not forget to check out book review of PHP Hacks Tips & Tools for Creating Dynamic Websites.Share this on: