如何查找在Ubuntu 14.04上安装的Apache服务器版本?
apache2 -v
-v
)apachectl -v
-V
)apachectl -V
apache2
代替apachectl
...只是给出了一个替代方案。这在我使用的Ubuntu 18.04和Apache 2.4.37上有效。如果你在apache2中安装了PHP,你可以在$_SERVER变量中找到它,或使用phpinfo()
函数:
<?php
var_dump($_SERVER);
phpinfo();
'SERVER_SIGNATURE' => string '<address>Apache/2.4.29 (Ubuntu) Server …</address>
'SERVER_SOFTWARE' => string 'Apache/2.4.29 (Ubuntu)'
# and in phpinfo arrays:
apache2handler
Apache Version Apache/2.4.29 (Ubuntu)
v
,另一个是大写的V
,它们可能代表了apachectl
的不同冗长程度,但我在 manpage 中找不到任何关于这些标志存在的指示。 - Kristopher Ives