WAMP: "'php' is not recognized as an internal or external command operable program or batch file" although adding PATH
Asked Answered
F

3

7

when I run PHP in CMD I get this error msg:

'php' is not recognized as an internal or external command operable program or batch file

the path was already added and I followed this tutorial:

http://perials.com/install-composer-on-windows-and-wamp/

C:\Program Files (x86)\Lenovo\FusionEngine;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Lenovo\Motion Control\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\; C:\wamp\bin\php\php5.5.12; C:\wamp\www; C:\wamp\www\AKP\examples\AdWords\Auth;C:\Program Files (x86)\Skype\Phone\;C:\ProgramData\ComposerSetup\bin

enter image description here

I created the file suggested in this post: Installing Composer globally for laravel usage?

and nothing.

Most of the posts I ran into solved the problem with adding the path - which doesn't solve mine.

I am currently using WAMP on Windows 10.

What can be the problem?

Fidge answered 16/3, 2016 at 10:14 Comment(4)
You don't show the exact commands or the exact PATH... Either one of them are wrong or you're reusing a command prompt that was opened before you changed PATH somewhere else thus did not inherit the value.Mangan
@ÁlvaroGonzález I edited my post, please reviewFidge
You have a lot of bogus spacesMangan
I think this is how Windows 10 displays %20.. I have never changes anything there so.. I am just guessing that this is how to insert this on Windows 10Fidge
B
7

I don't really understand what you mean with Windows 10 displaying %20 but error message says you don't have any php program in PATH and that's the exact problem. Path directories are not case sensitive (that's how Windows is designed to work) but spaces do matter:

C:\>PATH C:\WINDOWS;C:\PHP

C:\>php -v
PHP 5.6.15 (cli) (built: Oct 29 2015 12:40:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

C:\>PATH C:\WINDOWS; C:\PHP

C:\>php -v
"php" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\>PATH C:\PHP ;C:\WINDOWS

C:\>php -v
"php" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

Even if Windows 10 had changed PATH handling to fix some common errors (something I can't test right now) I think it's simpler to just type the right path verbatim.

Bacteriolysis answered 16/3, 2016 at 11:28 Comment(4)
Ohh, these spaces! Thank you!Fidge
The path did not improve when I added path. He helped you with your command. I do not understand what the problem is.Amon
@ÖzgürCanKaragöz In short: you must separate paths with ; and nothing else; no spaces around are allowed.Mangan
I had to add path through command line to make it work, though failed through WAMP Icon > Tools or Directly Adding Path to env variables, of course restart too.Loar
B
8

PHP is not included in your PATH. Right click you're My Computer, then Properties, Advanced System Settings, Environment Variables and then find PATH variable, add your PHP installation dir there. Close your previously launched CMDs, re-launch it, it should work now.

Bestiality answered 26/9, 2017 at 3:48 Comment(0)
B
7

I don't really understand what you mean with Windows 10 displaying %20 but error message says you don't have any php program in PATH and that's the exact problem. Path directories are not case sensitive (that's how Windows is designed to work) but spaces do matter:

C:\>PATH C:\WINDOWS;C:\PHP

C:\>php -v
PHP 5.6.15 (cli) (built: Oct 29 2015 12:40:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

C:\>PATH C:\WINDOWS; C:\PHP

C:\>php -v
"php" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\>PATH C:\PHP ;C:\WINDOWS

C:\>php -v
"php" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

Even if Windows 10 had changed PATH handling to fix some common errors (something I can't test right now) I think it's simpler to just type the right path verbatim.

Bacteriolysis answered 16/3, 2016 at 11:28 Comment(4)
Ohh, these spaces! Thank you!Fidge
The path did not improve when I added path. He helped you with your command. I do not understand what the problem is.Amon
@ÖzgürCanKaragöz In short: you must separate paths with ; and nothing else; no spaces around are allowed.Mangan
I had to add path through command line to make it work, though failed through WAMP Icon > Tools or Directly Adding Path to env variables, of course restart too.Loar
G
1

if you are working with xampp then search for environment variable > click environment variable > system variable > PATH > edit > new > copy paste the location of xampp for windows C:\xampp\php then you can check php version with command php -v

Gardener answered 3/6, 2022 at 10:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.