Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the presence of php and apache on ubuntu server through ssh

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.

like image 574
Shishant Avatar asked Nov 21 '09 18:11

Shishant


People also ask

How do I know if Apache is PHP enabled?

php in the Web server document root (installdir/apache2/htdocs/ for Apache or installdir/nginx/html for NGINX). Make sure the Web server is running, open a browser and type http://localhost/phptest.php. You should then see a screen showing detailed information about the PHP version you are using and installed modules.

How do I know if PHP is installed on Ubuntu Server?

Open a bash shell terminal and use the command “php –version” or “php -v” to get the version of PHP installed on the system.


2 Answers

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 $ 
like image 155
Peter Stuifzand Avatar answered Oct 06 '22 13:10

Peter Stuifzand


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.

like image 36
Heinzi Avatar answered Oct 06 '22 13:10

Heinzi