2 ways to check for Apache enabled modules

As a developer sometimes we not only need to do coding, but tweak server settings also. We should know the ways on how to change configuration settings like in apache how to enable mod_header module. Or how to increase LimitRequestBody in apache. Here is one of them trick to show you how to check which modules are enabled in apache.

1. From terminal

Apache modules list can be found from terminal. Below is a code, just copy and paste it in terminal. And you will get screen like below image.

apachectl -M

If you are on debian based system, above command won’t work. Try below command.

apache2ctl -M

Output should be like this.

Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php5_module (shared)
proxy_module (shared)
proxy_http_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)

apache loaded modules in terminal

apache loaded modules in terminal

2. From phpinfo()

Create an blank file on your server anywhere (on root is recommended), name it anything which others can’t guess. like, sdfssfes.php , 23egstesf.php.

You should be thinking why I told to name file like this. It’s because we are going to print our php information, so this should be confidential for security purpose.

put below code in that file.

<?php phpinfo(); ?>

and save it. Now run this file from browser.

You will get all php informations. Search for ‘Apache2handler’.  There will be table and in that find column “Loaded Modules”. It is list of all apache modules. See below screenshot.

apache2handler check enabled module

apache2handler check enabled module

 

Enjoy…!

Shyam has written 29 articles

Shyam is senior full stack developer, who loves to explore new technologies and work on them. He's passionate about coding so can code 24/7. He uses PHP as a backend programming language.

He knows Laravel, MySQL, AngularJS, ReactJS, Redis, Kubernetes, Git, CodeIgniter, PHP, MVC pattern, Lodash, jQuery, VanilaJS, Teamcity and many other technologies and tools.

Shyam writes notes and hacks on his blog (https://shyammakwana.me). In spare time he can be found @ StackOverflow or crafting any new open source application.

Passionate Programmer and Meditator #PERIOD.