php 不被识别为内部命令(在 Windows 中)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2920903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 08:08:43  来源:igfitidea点击:

php is not recognized as an internal command (in Windows)

phpwindowscmd

提问by sf_tristanb

I want to develop using a framework called Symfony but I do not have a Mac and I don't want to dual boot with Debian.

我想使用名为 Symfony 的框架进行开发,但我没有 Mac,也不想使用 Debian 进行双启动。

I tried virtual hosts via Virtual Box but it doesn't work. So I decided to stay on Windows.

我通过 Virtual Box 尝试了虚拟主机,但它不起作用。所以我决定留在 Windows 上。

So when the tutorial tells me to do

所以当教程告诉我做

php lib/vendor/symfony/data/bin/check_configuration.php

i do in the windows cmd :

我在 Windows cmd 中这样做:

php lib\vendor\symfony\data\bin\check_configuration.php

and it tells me:

它告诉我:

'php' is not recognized as an internal or external command

'php' 不被识别为内部或外部命令

I use UwAmp (php 5.2.12 + mysql + apache) which is stored in

我使用存储在的 UwAmp (php 5.2.12 + mysql + apache)

E:\logiciels\UwAmp\

inside I have bunch of files, but I guess that is important:

里面我有一堆文件,但我想这很重要:

E:\logiciels\UwAmp\apache\php_5.2.11

How to make the cmd PHP in the windows cmd work properly?

如何让windows cmd中的cmd PHP正常工作?

回答by Rob

You'll have to add the directory in which the php executable is located to your "path" variable (I guess in your case that would be E:\logiciels\UwAmp\apache\php_5.2.11 ). In Windows, you can do that as described here: http://www.computerhope.com/issues/ch000549.htm

您必须将 php 可执行文件所在的目录添加到您的“路径”变量中(我猜在您的情况下应该是 E:\logiciels\UwAmp\apache\php_5.2.11 )。在 Windows 中,您可以按照此处所述进行操作:http: //www.computerhope.com/issues/ch000549.htm

Any directory you place in this path variable (they're separated by a semicolon) will be automatically used in, for example, a cmd shell.

您放置在此路径变量中的任何目录(它们由分号分隔)都将自动用于例如 cmd shell。

回答by halfdan

You need to add the path where the binary resides in to the PATH variable. You can do this on XP and Win 7 under the System -> User settings -> User variables

您需要将二进制文件所在的路径添加到 PATH 变量中。您可以在 XP 和 Win 7 下的系统 -> 用户设置 -> 用户变量下执行此操作