How to check mod_headers and mod_expires modules enabled in apache
Asked Answered
I

4

28

I want to check whether mod_headers and mod_expires modules enabled or not in my server

Is there a way available to list apache enabled/disabled modules using some php function just like we list php information with phpinfo(); function?

Iniquity answered 9/1, 2012 at 20:13 Comment(0)
I
30

On Debian:

user@machine:~$ /usr/sbin/apache2 -l

Most GNU/Linux distros:

user@machine:~$ /usr/sbin/httpd -l

Ubuntu:

user@machine:~$ ls /etc/apache2/mods-enabled

On Mac OSX:

user@mymac:~$ httpd -l

On Win 7 (64-bit):

C:\Users\myuser>"\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -l

Try these commands from a terminal window in all but Windows, which will use CMD instead.

Irresolution answered 9/1, 2012 at 20:19 Comment(2)
On FreeBSD (and probably other variants): user@machine:~$ apachectl -MBandung
-l only shows compiled modules, what if module is shared??Exude
R
73

All the above answers are wrong. Use instead:

apachectl -t -D DUMP_MODULES

or

apachectl -M

Ravel answered 8/7, 2014 at 0:6 Comment(3)
CentOS & RHOS versions of those commands are /usr/sbin/httpd -t -DUMP_MODULES and /usr/sbin/httpd -MArnold
@Craig London apachectl is the control script and it is available in CentOS as well.Ravel
This should be accepted solution for this question.Shrader
I
30

On Debian:

user@machine:~$ /usr/sbin/apache2 -l

Most GNU/Linux distros:

user@machine:~$ /usr/sbin/httpd -l

Ubuntu:

user@machine:~$ ls /etc/apache2/mods-enabled

On Mac OSX:

user@mymac:~$ httpd -l

On Win 7 (64-bit):

C:\Users\myuser>"\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -l

Try these commands from a terminal window in all but Windows, which will use CMD instead.

Irresolution answered 9/1, 2012 at 20:19 Comment(2)
On FreeBSD (and probably other variants): user@machine:~$ apachectl -MBandung
-l only shows compiled modules, what if module is shared??Exude
H
7

Some versions of PHP/Apache show all loaded modules in phpinfo() under "Loaded Modules".

Speeve's answer shows compiled in modules (x6 on my system):

echo system('/usr/sbin/apache2 -l');

You'll also need to see your enabled modules (x36 for me):

echo system('ls /etc/apache2/mods-enabled/');

To get the list of disabled modules, run this command then cross off all the enabled modules:

echo system('ls /etc/apache2/mods-available/');
Honna answered 13/8, 2012 at 15:0 Comment(1)
The mods-enabled directory is pretty specific to Debian and Ubuntu, other distributions and operating systems handle modules differently.Extrajudicial
W
7

On Ubuntu you can see the list of enabled modules here,

/etc/apache2/mods-enabled
Wavy answered 23/10, 2015 at 16:0 Comment(2)
and check /etc/apache2/mods-available for a list of available modules; nice and simpleCapitalism
yup i'll take this ty!Carbineer

© 2022 - 2024 — McMap. All rights reserved.