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.
# 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 [~]#
Add the grep
command to check if a specific module is loaded. To check if the SSL module is present, use the following code:
# httpd -M | grep ssl
[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.
<?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?