Linux 如何通过ssh检查ubuntu服务器上php和apache的存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1776312/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check the presence of php and apache on ubuntu server through ssh
提问by Shishant
How can I check whether apache is installed with php and mysql on Ubuntu server through ssh?
如何通过 ssh 在 Ubuntu 服务器上检查 apache 是否安装了 php 和 mysql?
Also if it is installed, in which directory?
另外如果安装了,在哪个目录?
And if in case some other package is installed, like lighttpd, where that is.
如果安装了其他一些包,比如 lighttpd,那是什么。
采纳答案by Heinzi
Type aptitude
to start the package manager. There you can see which applications are installed.
键入aptitude
以启动包管理器。在那里您可以看到安装了哪些应用程序。
Use /
to search for packages. Try searching for apache2
and php5
(or whatever versions you want to use). If they are installed, they should be bold and have an i
in front of them. If they are not installed (p
in front of the line) and you want to install them (and you have root permissions), use +
to select them and then g
(twice) to install it.
使用/
搜索包。尝试搜索apache2
和php5
(或您想使用的任何版本)。如果安装了它们,它们应该是大胆的,并且i
在它们前面有一个。如果它们未安装(p
在该行的前面)并且您想安装它们(并且您具有 root 权限),请使用+
选择它们然后g
(两次)安装它。
Word of warning: Before doing that, it might be wise to have a quick look at some aptitudetutorial on the web.
警告:在此之前,快速浏览一下网络上的一些aptitude教程可能是明智之举。
回答by miku
You could inspect the available apache2 modules:
您可以检查可用的 apache2 模块:
$ ls /usr/lib/apache2/modules/
Or try to enable the php module, if you have the appropriate access:
或者尝试启用 php 模块,如果您有适当的访问权限:
$ a2enmod
Which module would you like to enable?
Your choices are: actions alias asis ...
... php5 proxy_ajp proxy_balancer proxy_connect ..
回答by Peter Stuifzand
Another way to find out if a program is installed is by using the which
command. It will show the path of the program you're searching for. For example if when your searching for apache you can use the following command:
确定程序是否已安装的另一种方法是使用该which
命令。它将显示您正在搜索的程序的路径。例如,如果您在搜索 apache 时可以使用以下命令:
$ which apache2ctl
/usr/sbin/apache2ctl
And if you searching for PHP try this:
如果您搜索 PHP,请尝试以下操作:
$ which php
/usr/bin/php
If the which
command doesn't give any result it means the software is not installed (or is not in the current $PATH
):
如果该which
命令没有给出任何结果,则表示该软件未安装(或不在当前$PATH
):
$ which php
$
回答by Eric Leschinski
How to tell on Ubuntu if apache2 is running:
如何在 Ubuntu 上判断 apache2 是否正在运行:
sudo service apache2 status
/etc/init.d/apache2 status
ps aux | grep apache
回答by Anmol Mourya
Try this.
尝试这个。
dpkg -s apache2 | grep Status
dpkg -s php5 | grep Status