Determining the modules which are loaded in Apache

The Apache HTTP server software supports many features via compiled modules which extend the core functionality of the web server software. Modules support various authentication methods, URL rewriting, proxying, etc. You can check on what modules are loaded using the command httpd -t -D DUMP_MODULES.

Generic Category (English)120x600
# httpd -t -D DUMP_MODULES
AH00558: httpd: Could not reliably determine the server's fully qualified domain
 name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this
 message
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 allowmethods_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_anon_module (shared)
 authn_core_module (shared)
 authn_dbd_module (shared)
 authn_dbm_module (shared)
 authn_file_module (shared)
 authn_socache_module (shared)
 authz_core_module (shared)
 authz_dbd_module (shared)
 authz_dbm_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_owner_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cache_module (shared)
 cache_disk_module (shared)
 data_module (shared)
 dbd_module (shared)
 deflate_module (shared)
 dir_module (shared)
 dumpio_module (shared)
 echo_module (shared)
 env_module (shared)
 expires_module (shared)
 ext_filter_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 info_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_magic_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 remoteip_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 slotmem_plain_module (shared)
 slotmem_shm_module (shared)
 socache_dbm_module (shared)
 socache_memcache_module (shared)
 socache_shmcb_module (shared)
 status_module (shared)
 substitute_module (shared)
 suexec_module (shared)
 unique_id_module (shared)
 unixd_module (shared)
 userdir_module (shared)
 version_module (shared)
 vhost_alias_module (shared)
 dav_module (shared)
 dav_fs_module (shared)
 dav_lock_module (shared)
 lua_module (shared)
 mpm_prefork_module (shared)
 proxy_module (shared)
 lbmethod_bybusyness_module (shared)
 lbmethod_byrequests_module (shared)
 lbmethod_bytraffic_module (shared)
 lbmethod_heartbeat_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 proxy_connect_module (shared)
 proxy_express_module (shared)
 proxy_fcgi_module (shared)
 proxy_fdpass_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_scgi_module (shared)
 systemd_module (shared)
 cgi_module (shared)
 php5_module (shared)
[root@starfield ~]#

Note: with Apache 2.4.6, you will see the warning message below if you use apachectl -t -D DUMP_MODULES:

Passing arguments to httpd using apachectl is no longer supported. You can only start/stop/restart httpd using this script. If you want to pass extra arguments to httpd, edit the /etc/sysconfig/httpd config file.

But you will see the list of modules displayed. You can determine the version of Apache that is running with httpd -v.

# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov 19 2015 21:43:13

If you have PHP on the system and are using Apache 2.x and a version of PHP greater than or equal to 4.3.2 or a version of PHP greater than or equal to 5.0 with Apache 1 or 2, you can see a list of the loaded modules using the following PHP code:

<?php print_r(Apache_get_modules()); ?>

That will result in a display similar to the following:

Array ( [0] => core [1] => mod_so [2] => http_core [3] => mod_access_compat [4] => mod_actions [5] => mod_alias [6] => mod_allowmethods [7] => mod_auth_basic [8] => mod_auth_digest [9] => mod_authn_anon [10] => mod_authn_core [11] => mod_authn_dbd [12] => mod_authn_dbm [13] => mod_authn_file [14] => mod_authn_socache [15] => mod_authz_core [16] => mod_authz_dbd [17] => mod_authz_dbm [18] => mod_authz_groupfile [19] => mod_authz_host [20] => mod_authz_owner [21] => mod_authz_user [22] => mod_autoindex [23] => mod_cache [24] => mod_cache_disk [25] => mod_data [26] => mod_dbd [27] => mod_deflate [28] => mod_dir [29] => mod_dumpio [30] => mod_echo [31] => mod_env [32] => mod_expires [33] => mod_ext_filter [34] => mod_filter [35] => mod_headers [36] => mod_include [37] => mod_info [38] => mod_log_config [39] => mod_logio [40] => mod_mime_magic [41] => mod_mime [42] => mod_negotiation [43] => mod_remoteip [44] => mod_reqtimeout [45] => mod_rewrite [46] => mod_setenvif [47] => mod_slotmem_plain [48] => mod_slotmem_shm [49] => mod_socache_dbm [50] => mod_socache_memcache [51] => mod_socache_shmcb [52] => mod_status [53] => mod_substitute [54] => mod_suexec [55] => mod_unique_id [56] => mod_unixd [57] => mod_userdir [58] => mod_version [59] => mod_vhost_alias [60] => mod_dav [61] => mod_dav_fs [62] => mod_dav_lock [63] => mod_lua [64] => prefork [65] => mod_proxy [66] => mod_lbmethod_bybusyness [67] => mod_lbmethod_byrequests [68] => mod_lbmethod_bytraffic [69] => mod_lbmethod_heartbeat [70] => mod_proxy_ajp [71] => mod_proxy_balancer [72] => mod_proxy_connect [73] => mod_proxy_express [74] => mod_proxy_fcgi [75] => mod_proxy_fdpass [76] => mod_proxy_ftp [77] => mod_proxy_http [78] => mod_proxy_scgi [79] => mod_systemd [80] => mod_cgi [81] => mod_php5 )

To print each module on a separate line, you can use the following code:

<?php
   $mod_array = apache_get_modules();
   foreach($mod_array as $val) {
     print "$val
\n"; } ?>

That would produce a list similar to the following one:

core
mod_so
http_core
mod_access_compat
mod_actions
mod_alias
mod_allowmethods
mod_auth_basic
mod_auth_digest
mod_authn_anon
mod_authn_core
mod_authn_dbd
mod_authn_dbm
mod_authn_file
mod_authn_socache
mod_authz_core
mod_authz_dbd
mod_authz_dbm
mod_authz_groupfile
mod_authz_host
mod_authz_owner
mod_authz_user
mod_autoindex
mod_cache
mod_cache_disk
mod_data
mod_dbd
mod_deflate
mod_dir
mod_dumpio
mod_echo
mod_env
mod_expires
mod_ext_filter
mod_filter
mod_headers
mod_include
mod_info
mod_log_config
mod_logio
mod_mime_magic
mod_mime
mod_negotiation
mod_remoteip
mod_reqtimeout
mod_rewrite
mod_setenvif
mod_slotmem_plain
mod_slotmem_shm
mod_socache_dbm
mod_socache_memcache
mod_socache_shmcb
mod_status
mod_substitute
mod_suexec
mod_unique_id
mod_unixd
mod_userdir
mod_version
mod_vhost_alias
mod_dav
mod_dav_fs
mod_dav_lock
mod_lua
prefork
mod_proxy
mod_lbmethod_bybusyness
mod_lbmethod_byrequests
mod_lbmethod_bytraffic
mod_lbmethod_heartbeat
mod_proxy_ajp
mod_proxy_balancer
mod_proxy_connect
mod_proxy_express
mod_proxy_fcgi
mod_proxy_fdpass
mod_proxy_ftp
mod_proxy_http
mod_proxy_scgi
mod_systemd
mod_cgi
mod_php5

References:

  1. How to get the list of apache modules enabled with php
    Posted: July 1, 2011
    Stack Overflow

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px