Finding out which version PHP a remote server is running

I can't imagine this is possible but maybe there's some novel way. I'm developing an app which will require a few php files to be deployed and run on the clients' webservers. I'm not particularly interested in targeting clients who are still running pre version 5 versions of PHP.

So is there any way one can tell which version of PHP a remote webserver has running?


You can use a site to view http headers such as http://web-sniffer.net/

Some sites will return the PHP version in the server section of the header for example here's a response from a site I just tested:

Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.12

This is more likely to work on sites hosted on a standard shared hosting platform such as cPanel.


Many servers provide an X-Powered-By header which might include the PHP version. Try querying the server with curl:

curl -I http://example.com

You can olso view X-Powered-By header using some browser add-ons, for example "Live HTTP Headers" add-on to Mozilla Firefox. However most production servers doesn't include X-Powered-By header.