How to get the loaded Apache modules

The list of loaded modules can be obtained easily if you have SSH access to the server. We will use the httpd command with the -M option. -M will output a list of loaded Static and Shared Modules.

# httpd -M
root@web [~]# httpd -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_event_module (shared)
 systemd_module (shared)
 lsapi_module (shared)
 cgid_module (shared)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_dbm_module (shared)
 authn_file_module (shared)
 authn_socache_module (shared)
 authz_core_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 dbd_module (shared)
 deflate_module (shared)
 dir_module (shared)
 expires_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_http_module (shared)
 proxy_wstunnel_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 slotmem_shm_module (shared)
 socache_dbm_module (shared)
 socache_shmcb_module (shared)
 socache_redis_module (shared)
 status_module (shared)
 suexec_module (shared)
 unique_id_module (shared)
 unixd_module (shared)
 userdir_module (shared)
 bwlimited_module (shared)
 ssl_module (shared)
 http2_module (shared)
 security2_module (shared)
root@web [~]#

To check if a specific module is loaded, add the grep command. For example to check the if the ssl module is present, use:

# httpd -M | grep ssl
[root@web ~]# httpd -M | grep ssl
 ssl_module (static)
[root@web ~]#

If you don’t have SSH access to the web server, you can use the apache_get_modules PHP function to get the loaded modules. This method will work only if the PHP is installed as an Apache Module (mod_php). (it will not work with PHP-FPM for example) Create a PHP file – e.g. apachemodules.php – with the following content and access it in your browser.

<?php
// prints Apache Modules - works only if the PHP is installed as an Apache Module
echo 'The Apache Modules found on the server are:</br>';

print_r(apache_get_modules());

?>
apache logo
Apache HTTP Server Logo

Resources:
apache_get_modules
httpd server

Leave a Reply