To Find Out Version of LAMP (Linux, Apache, MySQL, PHP) Via the Command Line

I am running a LAMP server on Slicehost. I always have to look up how to determine the version of each component of the LAMP server I am running. I am using Ubuntu Linux 8.04.4 (Hardy). In my case, here are the command-line instructions I use. I hope this helps you too. Btw, the command "whereis" is very helpful in locating programs (i.e. whereis apache2). Linux

> more /etc/issue


> lsb_release -a

Apache 2

> /usr/sbin/apache2 -V

Note: Apache 2 doesn't have "httpd" anymore. It was changed to "apache2" instead.


First log into your MySQL database from the command line, using something to the effect of:

> mysql -u username -p


mysql> select version();


> php -v


> php5 -v

Note: This assumes you have PHP 5 installed and that you have installed the Command Line Interface (CLI) to PHP via "sudo aptitude install php5-cli". Alternatively, you can find out the version of PHP via instruction "< ? phpinfo() ?>" within a .php file.