如何检查在apache中启用的mod_headers和mod_expires模块


How to check mod_headers and mod_expires modules enabled in apache

我想检查我的服务器中是否启用了mod_headers和mod_expires模块

有没有一种方法可以使用一些php函数列出启用/禁用apache的模块,就像我们用phpinfo()列出php信息一样函数?

以上所有答案都是错误的。改为使用:

apachectl -t -D DUMP_MODULES

apachectl -M

关于Debian:

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

大多数GNU/Linux发行版:

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

Ubuntu:

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

在Mac OSX上:

user@mymac:~$ httpd -l

在Win 7(64位)上:

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

在除Windows之外的所有系统中,从终端窗口尝试这些命令,后者将使用CMD。

某些版本的PHP/Apache在"loaded modules"下显示phpinfo()中所有加载的模块。

Speeve的答案显示编译在模块中(在我的系统上为x6):

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

您还需要查看您启用的模块(对我来说是x36):

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

要获得禁用模块的列表,请运行此命令,然后划掉所有启用的模块:

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

在Ubuntu上,你可以在这里看到启用模块的列表,

/etc/apache2/mods-enabled