Go to c drive and run the command as below
C:\xampp\php>php -v
You just need to find out where is your PHP folder.
cd \xampp\php (FOR XAMPP)
cd \wamp\php (FOR WAMP)
php -v
PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Nothing to worry it's easy
If you are using any local server like Wamp, Xampp then Go to this Steps
You will find php.exe, Once you get php.exe then you are done. Just type the path like below, here i am using XAMPP and type v for checking version and you are done.
C:>"C:\xampp\php\php.exe" -v
Thanks.
This how I check php version
PS C:\Windows\system32> php -version
Result:
PHP 7.2.7 (cli) (built: Jun 19 2018 23:44:15) ( NTS MSVC15 (Visual C++ 2017) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
PS C:\Windows\system32>
xampp control panel->shell->type php-v you get the version of php of your xampp installed
DB(mariadb/mysql)version type localhost/phpmyadmin in url click enter click on sql type select version(); enter to get the mysql or mariaDb version
Just create a php file and write the code
<?php
echo phpversion();
?>
and open the file in any browser. It will show the php version installed in your system.
Step 1 : Open CMD
Step 2 : Go to C:/xampp/php or htdocs path:/
step 3 : Type "php -v "
Result php version
Easy Method is: Just copy the file cmd.exe from c:/windows/system32/ and paste it to C:\xampp\php\ and run it, when the cmd opens type " php -v " without quotes and hit enter... you will get your php version.. thank you
For me, the PHP path traversed from php5.6.25 (or php7) installation folder, through wamp folder, bin and php...
C:\wamp64\bin\php\php5.6.25>
For Beginners to anything php, it is usually stored in the C:/ path folder of your PC (My Computer).
==On Windows==
1.Click Start Menu button
2.Type cmd and press enter to select the first program/application that responds to your search result.
A black window terminal will appear, this is known as a Command Line Interpreter
3.In the Terminal Window (Application) Type cd c: and press enter
4.Now type php -v and press enter
and viola there you'll have the current php version that is installed in your machine
It is most likely that php is not in your specified path.
Try to issue the php command with the full path, for example:
C:\> "C:\Program Files\php\php.exe" -v
Please note, that this is just an example, your php installation might be in a different directory.
Then go to php folder directory, Suppose your php folder is in xampp folder on your c drive. Your command would then be:
cd c:\xampp\php
After that, check your version:
php -v
This should give the following output:
PHP 7.2.0 (cli) (built: Nov 29 2017 00:17:00) ( ZTS MSVC15 (Visual C++ 2017) x86 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
I have uploaded a youtube video myself about checking the version of PHP via command prompt in Bangla: https://www.youtube.com/watch?v=zVkhD_tv9ck
Output : PHP 5.6.30
You will get your php version details
Source: Stackoverflow.com