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 - also there are thousands of questions with the same error description (just the name differes), please use the search before asking.hakre– hakre2013-03-20 09:28:56 +00:00Commented Mar 20, 2013 at 9:28
-
@hakre I am sorry.I apologized.ntf– ntf2013-03-20 10:02:16 +00:00Commented Mar 20, 2013 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
Windowsicon
Step 2 - Click on the
Settingsicon
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
Pathrow and then clickEdit
Step 9 - Click
Newand 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
OKand click everyOKbutton you will encounter to close every previous windows.
7 Comments
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
Comments
- 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\phpAfter 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
Comments
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
Comments
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.
Comments
If you are not sure where php is installed on your system, try:
.\php -v
1 Comment
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.










