It is easy to get the list of loaded Apache modules if you have SSH access to the server.
The steps include using the httpd command with the -M option. You can obtain the list of loaded Static and Shared Modules by using the -M option.
1 |
# httpd -M |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
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 [~]# |
Add the grep
command to check if a specific module is loaded. To check if the SSL module is present, use the following code:
1 |
# httpd -M | grep ssl |
1 2 3 |
[root@web ~]# httpd -M | grep ssl ssl_module (static) [root@web ~]# |
You can use the apache_get_modules
PHP function to get the loaded Apache modules if you do not have SSH access to the webserver.
The apache_get_modules
method works only if the PHP is installed as an Apache Module (mod_php). Create a PHP file – e.g. apachemodules.php and add the following content and access it in your browser.
1 2 3 4 5 6 7 |
<?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()); ?> |
Related article: Nginx vs Apache – What’s the Difference and What to Use?