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?

Giri
  • 4,849
  • 11
  • 39
  • 48

4 Answers4

72

All the above answers are wrong. Use instead:

apachectl -t -D DUMP_MODULES

or

apachectl -M

noun
  • 3,635
  • 2
  • 25
  • 27
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.

kjones
  • 1,339
  • 1
  • 13
  • 28
speeves
  • 1,358
  • 9
  • 10
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/');
Steve Almond
  • 413
  • 4
  • 12
  • 1
    The `mods-enabled` directory is pretty specific to Debian and Ubuntu, other distributions and operating systems handle modules differently. – Martijn Pieters Oct 06 '12 at 15:57
7

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

/etc/apache2/mods-enabled
Won Jun Bae
  • 5,140
  • 6
  • 43
  • 49