Can anybody tell me how to find the version of apache and PHP running on a Linux Machine.
The output of phpinfo() provides this information.
Or from the shell, if you have access to the machine:
php -i
Or if the machine is remote and you have LWP installed, you can do the following to see which version of the webserver it is running:
HEAD www.example.com
Or if you don't have LWP installed, you can use the LiveHTTPHeaders extension for Firefox, just hit ^i while viewing a page and look at the headers..
The latter two presume that your server exports the ServerTokens[3] variable in Apache as something useful.
I personally don't broadcast my Apache version, because it gives remote attackers another piece of information I don't want them to have to try to exploit my machine, if a hole in the version of Apache is found before I have a chance to fix it.
[1] http://search.cpan.org/~gaas/libwww-perl-5.69/bin/lwp-request [2] https://addons.mozilla.org/firefox/3829/ [3] http://httpd.apache.org/docs/2.2/mod/core.html#servertokens