Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find PHP version on windows command line

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.

like image 858
ntf Avatar asked Mar 20 '13 07:03

ntf


People also ask

What version of PHP do I have terminal?

Open a bash shell terminal and use the command “php –version” or “php -v” to get the version of PHP installed on the system.


2 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

enter image description here

Step 2 - Click on the Settings icon

enter image description here

Step 3 - Click on System

enter image description here

Step 4 - Click on About

enter image description here

Step 5 - Click on System info

enter image description here

Step 6 - Click on Advanced system settings

enter image description here

Step 7 - Click on Environment variables...

enter image description here

Step 8 - Select Path row and then click Edit

enter image description here

Step 9 - Click New and then click Browse, then in the next panel which will open you need to select the folder you want in the Path. For the initial premise of this guide i will add the folder C:\Users\NewFolderInPath

Note: Replace your PHP installed path(e.g:C:\Program Files\php) with the above path ♥.

enter image description here

Step 10 - Click OK and click every OK button you will encounter to close every previous windows.

enter image description here

like image 149
NullPoiиteя Avatar answered Sep 30 '22 20:09

NullPoiиteя


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

like image 42
shivam gupta Avatar answered Sep 30 '22 20:09

shivam gupta