43

How can I check whether apache is installed with php and mysql on Ubuntu server through ssh?

Also if it is installed, in which directory?

And if in case some other package is installed, like lighttpd, where that is.

0

5 Answers 5

46

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 apache2ctl
/usr/sbin/apache2ctl

And if you searching for PHP try this:

$ 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 php
$
Sign up to request clarification or add additional context in comments.

3 Comments

theres no response when i try this
That means that those programs are not installed or are called by a different name. But if you use Ubuntu, this should work. Also if the first one (for apache) doesn't work, probably the second also won't work.
I think this easy and best way thaks @PeterStuifzand
32

Type aptitude to start the package manager. There you can see which applications are installed.

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.

Word of warning: Before doing that, it might be wise to have a quick look at some aptitude tutorial on the web.

3 Comments

It shows perl python etc but not php and apache does this mean it is not installed?
See above, I've extended my answer.
Thanks a lot apache was not installed. I will find some tutorial on setting up a ubuntu server
14

How to tell on Ubuntu if apache2 is running:

sudo service apache2 status

/etc/init.d/apache2 status

ps aux | grep apache

Comments

6

You could inspect the available apache2 modules:

$ ls /usr/lib/apache2/modules/

Or try to enable the php module, if you have the appropriate access:

$ a2enmod
Which module would you like to enable?
Your choices are: actions alias asis ...
... php5 proxy_ajp proxy_balancer proxy_connect ..

2 Comments

After trying this i get no such file or directory
This means apache2 is not installed. Use sudo aptitude install apache2 to install it.
1

Try this.

dpkg -s apache2 | grep Status 

dpkg -s php5 | grep Status

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.