Home » Php » Php version on windows command line

Php version on windows command line

Posted by: admin November 30, 2017 Leave a comment


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.


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 5.4.9  (cli) (built: Dec 12 2012 07:06:13 )    


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


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.


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


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…


  1. open cmd 2. type cd.. three times then 3. type c:\xampp\php now type php -v
  1. copy cmd.exe and go to the php folder (c:\path\php) and paste it.
  2. write in cmd: php -v