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

发布于 2024-12-25 16:14:48 字数 147 浏览 6 评论 0原文

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

暮倦 2025-01-01 16:14:48

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

apachectl -t -D DUMP_MODULES

apachectl -M

All the above answers are wrong. Use instead:

apachectl -t -D DUMP_MODULES

or

apachectl -M

无需解释 2025-01-01 16:14:48

在 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。

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.

三岁铭 2025-01-01 16:14:48

某些版本的 PHP/Apache 在“已加载模块”下的 phpinfo() 中显示所有已加载模块。

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

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

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

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

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

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

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/');
踏月而来 2025-01-01 16:14:48

在 Ubuntu 上,您可以在此处查看启用的模块列表,

/etc/apache2/mods-enabled

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

/etc/apache2/mods-enabled
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文