I just tried to know version of my PHP from windows command typing,
C:\> php -v
But it is not working. It says php is not recognized as internal or external command
.
-
Also [that PHP error windows commandline related: How to bake cakephp 2.0 application on windows with wamp](http://stackoverflow.com/questions/9748506/how-to-bake-cakephp-2-0-application-on-windows-with-wamp) - also there are thousands of questions with the same error description (just the name differes), please use the search before asking. – hakre Mar 20 '13 at 09:28
-
@hakre I am sorry.I apologized. – ntf Mar 20 '13 at 10:02
18 Answers
In command prompt type below
set PATH=%PATH%;C:\path\to\php
Where C:\path\to\php is the folder where your php.exe
file is located. After this run
C:\>php -v
than you will see something like
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00)
UPDATE:
If you find that when you restart your computer, this solution will not work anymore:
Set the Path like as following:
Step 1 - Click on the
Windows
icon
Step 2 - Click on the
Settings
icon
Step 3 - Click on
System
Step 4 - Click on
About
Step 5 - Click on
System info
Step 6 - Click on
Advanced system settings
Step 7 - Click on
Environment variables...
Step 8 - Select
Path
row and then clickEdit
Step 9 - Click
New
and then clickBrowse
, then in the next panel which will open you need to select the folder you want in thePath
. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPath
♥Note: Replace your PHP installed path(e.g:
C:\Program Files\php
) with the above path ♥.
Step 10 - Click
OK
and click everyOK
button you will encounter to close every previous windows.

- 1
- 1

- 56,591
- 22
- 125
- 143
-
-
@ntf [check this](http://stackoverflow.com/questions/6832496/command-prompt-how-to-add-a-set-path-only-for-that-batch-file-executing) – NullPoiиteя Mar 20 '13 at 08:14
-
-
8this person deserves a medal for taking the time to take all these screenshots <3 – Gurnzbot Mar 19 '20 at 13:39
-
2Shortcut is press window button type environment.... open these dialogues and proceed. – Vishal Kumar Sahu May 25 '20 at 01:16
-
1Also you can write Environment variables in window search and cont. from step 7 from above. – Atul Baldaniya Mar 26 '21 at 05:33
-
You just need to find out where is your PHP folder.
- If you are using XAMPP or WAMP then you will see a php folder.
- You just need to go into the php folder using your cmd using command
cd \xampp\php (FOR XAMPP)
cd \wamp\php (FOR WAMP)
- And then just type in this command
php -v
- Then you will see something like
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

- 1
- 1

- 471
- 5
- 10
- First open your cmd
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
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

- 112
- 4
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.

- 9,813
- 6
- 42
- 57
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.

- 116
- 1
- 9
Step 1 : Open CMD
Step 2 : Go to C:/xampp/php or htdocs path:/
step 3 : Type "php -v "
Result php version

- 1,001
- 1
- 10
- 23
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

- 21
- 2
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

- 511
- 4
- 5
- Open command prompt
- Locate directory using cd C:/Xampp/php
- Type command php -v
You will get your php version details

- 485
- 6
- 9
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>
In similar way other providers like WAMP/XAMPP on windows have PHP installed under <provider-base-dir>\bin\php
directory (even multiple PHP version come from there.
On windows, to know from where your PHP is being executed use
where php
or if server is already running create a PHP file to know more about running PHP using phpversion as below
<?php
echo phpversion();
BONUS: Sometimes, PHP is not present in windows path, you can add PHP path to Windows environment PATH variable.

- 1,232
- 3
- 15
- 27
Easiest way is to, just click on the WAMP icon on task bar and Go to PHP >Version, version will be displayed

- 104
- 10
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>

- 3,382
- 2
- 21
- 27
Nothing to worry it's easy
If you are using any local server like Wamp, Xampp then Go to this Steps
- Go to your drive
- Check xampp or wamp server that you installed
- Inside that check php, if you got then go for next step
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.

- 3,056
- 24
- 26
If the xampp
is installed in your c
drive then try the below commonds first open cmd and then
type
cd c:
then
C:\xampp\php\php.exe -v

- 1,313
- 10
- 30
If you are not sure where php is installed on your system, try:
.\php -v

- 43
- 5
-
This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32101078) – Monnomcjo Jun 30 '22 at 06:41