PHP is not recognized as an internal or external command line command

When running a command with php

I got the following error:
 C:\xampp\htdocs>php 'php' is not recognized as an internal or external command, operable program or batch file. 

I get no errors when running a command with php in the following path:

 C:\xampp\php>php //do not got error here 

Why am I getting this error?

'php' is not recognized as an internal or external command, operating program, or batch file.

+77
exe php cmd
Jul 08 '15 at 11:28
source share
8 answers

Add C:\xampp\php to the PATH environment.

Then close the command prompt and restart again.

This is very important because if you do not restart the command line, the changes will not be reflected.

+124
Jul 08 '15 at 11:32
source share

You need to go to My Computer-> properties → Advanced system settings

Now click on environment variables

enter image description here

Add ; C: \ xampp \ php in the value of the path variable

enter image description here

Now restart the command line Done!

Note: make sure you run CMD through the administrator

+76
Jan 12 '17 at 18:00
source share

Set "C:\xampp\php" in the PATH environment variable. Then restart the CMD prompt.

+7
Jul 08 '15 at 11:37
source share

You just need to add the path to your PHP file. If you use wamp or did not install it on drive C.

The picture shows how to find the path

+7
Sep 01 '17 at 7:22
source share

Is your path configured correctly?

On Windows, you can do this as described here:

http://www.computerhope.com/issues/ch000549.htm

+5
Jul 08 '15 at 11:31 on
source share

You need to add C:\xampp\php to the PATH Environment Variable , only after that you can execute the php command line from outside php_home .

+4
Jul 08 '15 at 11:31 on
source share

I also got the following error when running a command with PHP , I made a decision like this:

  1. On the desktop, right-click the Computer icon.
  2. Select Properties from the context menu.
  3. Click on the link Advanced system settings.
  4. Click Environment Variables. In the System Variables section, find the PATH environment variable and select it. Click Change. If the PATH environment variable does not exist, click New.
  5. In the Change C:\xampp\php variable window, add C:\xampp\php to the PATH environment variable .

Very important note: restart the command line

+2
Mar 19 '18 at 10:24
source share

enter image description here enter image description here

Here's what I do on my PC: I install all the software that I usually used in G: partian not C: if my operating system crashes (win 10), I do not need to reinstall them again and lost time, then how do the PATH windows work automatically if you install any new program or piece of software,

SO

I have to update PATH, like this HERE! all my software i used to use

 %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;G:\HashiCorp\Vagrant\bin;G:\xampp\php;G:\xampp\mysql\bin;G:\Program Files (x86)\heroku\bin;G:\Program Files (x86)\Git\bin;G:\Program Files (x86)\composer;G:\Program Files (x86)\nodejs;G:\Program Files (x86)\Sublime Text 3;G:\Program Files (x86)\Microsoft VS Code\bin;G:\Program Files (x86)\cygwin64\bin 

enter image description here

0
Nov 25 '18 at 8:31
source share



All Articles