If you are a Linux command line lover you can run this and see what version of PHP you are running:
php -i
or you can alternatively run this to get strictly the version number
php -v
Find PHP version on Windows
php -v is also working on Windows platforms. You can just start your CMD and run it to see the PHP version you currently have installed.
This will not work if you did not include php.exe into the system path. So if this is your case you will have to locate php.exe on your system. Main is located here: C:\xampp\php so I will run the set command using this path like this:
set PATH=%PATH%;C:\xampp\php\php.exe
Now run again php -v and you should see you PHP version.
Find PHP version when you do not have access to an SSH console.
When you do not have access to a command-line console you can find the PHP version using the phpinfo() function.
Just put it in a new .php file and access it via your URL.
<?php phpinfo() ?>
Or just a simpler way is to use the phpversion() specific function or the PHP_VERSION constant.
<?php echo 'PHP version is: ' . phpversion(); echo 'PHP version is: ' . PHP_VERSION; ?>
Why do I need to know my PHP version
There are plenty of reasons Why you may be interested in the PHP version you are running. One would be that some functions are not available on some packages and other functions are deprecated on others.
If you want to know your PHP version and do something or something else depending on your release number you may be interested in using the compare like this.
if (version_compare(PHP_VERSION, '7.0.0') >= 0) { echo 'I am at least PHP version 7.0.0, my version: ' . PHP_VERSION . "\n"; } if (version_compare(PHP_VERSION, '5.3.0') >= 0) { echo 'I am at least PHP version 5.3.0, my version: ' . PHP_VERSION . "\n"; } if (version_compare(PHP_VERSION, '5.0.0', '>=')) { echo 'I am at least PHP version 5.0.0, my version: ' . PHP_VERSION . "\n"; } if (version_compare(PHP_VERSION, '5.0.0', '<')) { echo 'I am still PHP 4, my version: ' . PHP_VERSION . "\n"; }
Hope this helps you