问题描述
我在驱动器 D:
上安装了 Windows 7 和 WAMP 本地主机.我正确安装了 Symfony2.当我打开 http://127.0.0.1/Symfony/web/config.php
我可以看到欢迎!信息.但是在教程在 Symfony2 中创建页面"中,当我想通过以下命令创建包时:
I have Windows 7 and WAMP localhost on drive D:
. I installed Symfony2 correctly. When I open http://127.0.0.1/Symfony/web/config.php
I can see the Welcome! message. But in the tutorial "Creating Pages in Symfony2" when I want to create a bundle by this command:
php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml
出现此消息:
"php is not recognized as an internal or external command oprable program or batch file"
我不知道我应该做什么.
I don't know what I should do.
推荐答案
您收到该错误,因为 PHP 不在您的系统 PATH
中.查看关于在 Windows 上安装 PHP 的此快速教程.请注意第 4 步,这是可以解决您的问题的安装步骤.
You are receiving that error because PHP is not in your system PATH
. Check out this quick tutorial on installing PHP on Windows. Take note of Step 4 which is the installation step that should fix your problem.
由于您使用的是 WampServer,您必须添加到 PATH
的路径将是这样的:
Since you're using WampServer, the path you have to add to PATH
will be something like this:
"C:\Program Files (x86)\Wamp\bin\php5.3.10"
这只是一个示例,将路径更改为您系统上 PHP 的实际路径.如果路径中有空格(如 Program Files (x86)
那样),则始终用引号 (") 将其括起来会很有帮助.
This is only an example, change the path to the actual path to PHP on your system. If the path has spaces in it (like Program Files (x86)
does) it is helpful to always surround it with quotes (").
更新:我最终与 @reza 一起使用屏幕共享程序,并发现他不小心将他的 PATH
变量设置为 D:\php\wamp\bin\php\php5.3.10\php.exe
而不是 D:\php\wamp\bin\php\php5.3.10
.解决这个问题解决了问题.
Update: I ended up getting on a screen sharing program with @reza and discovered he had accidentally set his PATH
variable to D:\php\wamp\bin\php\php5.3.10\php.exe
rather than D:\php\wamp\bin\php\php5.3.10
. Fixing this solved the problem.
这篇关于我无法在 symfony2 中创建包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!