Display a list of loaded Apache modules
|Debian (Lenny, Squeeze)|
To display a list of loaded Apache modules
Most of the functionality of the Apache web server is provided by modules. A module can be either:
- static, meaning that it is built into the Apache executable at compile time (and is therefore always available), or
- shared, meaning that it is loaded at run time by a
LoadModuledirective within the Apache configuration file.
It is thus possible for a shared module to be installed on a machine, but not loaded by Apache and therefore not usable. This is one of the more common reasons for Apache failing to start or failing to behave as expected.
Suppose that you are attempting to use the Apache
RewriteRule directives, but Apache fails to start with the error:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
This is a strong hint that
mod_rewrite (which provides the two directives) has not been loaded, however in the interests of systematic troubleshooting you wish to explicitly determine whether or not that is the case.
The method described here requires that the Apache configuration files be in a usable state. If they are not (as could well be the case if you find yourself needing to carry out this procedure) then you will need to temporarily fix the configuration so that it is capable of being loaded. Useful tools for doing this include:
- the hash character (‘#’), which when placed at the start of a line turns it into a comment;
<IfDefine>directive, which can be used to quickly disable a large section of a configuration file; and
a2dissitecommand provided on Debian-based systems, which can be used to easily disable the configuration for an Apache virtual host.
You should obviously try to avoid disabling any part of the configuration that includes any
It is feasible to obtain a list of static modules even if the configuration is broken, but this is of limited value for troubleshooting. A configuration file is essential for listing shared modules because without one none of them would be loaded.
A list of loaded Apache modules can be obtained using the
On Debian-based systems running Apache 2 this command is called
The output should include all loaded modules (both static and shared) and should be of the form:
Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_worker_module (static) http_module (static) so_module (static) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgid_module (shared) dir_module (shared) env_module (shared) mime_module (shared) negotiation_module (shared) setenvif_module (shared) status_module (shared) Syntax OK
Note that the names listed above are module identifiers, which are not the names by which modules are usually known. To convert from one to the other the usual convention is to remove the
_module suffix and replace it with a prefix of
mod_. For example, the module identified as
alias_module is more commonly known as