如何查看Debian机器上安装了Apache的哪个版本?
有这样做的命令吗?
如何查看Debian机器上安装了Apache的哪个版本?
有这样做的命令吗?
当前回答
该命令取决于您的Linux版本如何命名Apache Server。
在Debian和Mac OS上:
apachectl -v
在Red Hat和Amazon的EC2 Linux上使用:
httpd -v
在其他版本的Linux上尝试:
apache2 -v
你可以使用两种不同的标志:
-v # gives you the version number
-V # gives you the compile settings including version number.
如果你想在完整目录下运行命令,比如user3786265,但不知道你的apache位于哪里,使用whereis命令:
whereis httpd
其他回答
我尝试运行命令“httpd -V”和“apachectl -V”,但我无法执行,并得到错误:
-ksh: php: not found[没有这样的文件或目录]
然后我尝试了另一种方法。我进入服务器上的Apache目录,然后尝试执行命令:
./apachectl -v
这为我工作,并返回输出:
Server version: Apache/2.2.20 (Unix)
Server built: Sep 6 2012 17:22:16
我希望这能有所帮助。
用sudo试试
apachectl -V
-bash: apachectl: command not found
sudo apachectl -V
Server version: Apache/2.4.6 (Debian)
Server built: Aug 12 2013 18:20:23
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.3
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 32-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
bla bla....
对我来说,apachectl -V不起作用,但apachectl fullstatus给了我我的版本。
该命令取决于您的Linux版本如何命名Apache Server。
在Debian和Mac OS上:
apachectl -v
在Red Hat和Amazon的EC2 Linux上使用:
httpd -v
在其他版本的Linux上尝试:
apache2 -v
你可以使用两种不同的标志:
-v # gives you the version number
-V # gives you the compile settings including version number.
如果你想在完整目录下运行命令,比如user3786265,但不知道你的apache位于哪里,使用whereis命令:
whereis httpd
当然,在shell中输入/usr/sbin/apache2 -v是最好和最快的方法,顺便说一下,这里还有另一种选择,以防你的服务器中也有PHP,你有兴趣在快速编程步骤中收集Apache版本(以及更多信息)。
在你的Apache web根文件夹(或任何你喜欢的文件夹)中创建一个info.php文件,并在里面写这些:
<?php
phpinfo();
?>
现在转到yoursite.com/info.php(或localhost/info.php用于本地计算机)。
你会在PHP变量部分看到你的Apache版本,这里有一个例子:
Phpinfo()示例转储页面
另外,请注意,这些步骤显然适用于任何与PHP集成的web服务器,所以它并不局限于Apache,一旦创建了页面,在开发时就可以方便地使用(只是不要忘记在生产环境中删除它!!)