Amazon How do you check PHP version without calling phpinfo()? Is there a way to check my PHP version without using phpversion()? The point is I don't want to create a new PHP file on my web server just to find my PHP engine's version. I just want to find out my PHP version by running some command on my Unix machine.
Solution
If you've installed php5-fpm, run the following Unix command to see the PHP engine's version:
2 | PHP 5.5.9-1ubuntu4.9 (fpm-fcgi) (built: Apr 17 2015 11:44:58) |
3 | Copyright (c) 1997-2014 The PHP Group |
4 | Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies |
5 | with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies |
As you can see, the command to show the PHP version is
php5-fpm --version. My PHP version is 5.5.9.
If you are on an older PHP platform, you can run
php --version or
/usr/bin/php5-cgi v to find out your PHP CGI's version, as shown below.
02 | PHP 5.3.2-1ubuntu4.20 with Suhosin-Patch (cli) (built: Jul 15 2013 17:15:36) |
03 | Copyright (c) 1997-2009 The PHP Group |
04 | Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies |
07 | X-Powered-By: PHP/5.3.2-1ubuntu4.20 |
08 | Content-type: text/html |
10 | No input file specified. |
As you can see the PHP version is 5.3.2-1ubuntu4.20.
If your php5-cgi is installed elsewhere you need to use that location instead.
Questions? Let me know!