简体   繁体   English

我无法在symfony2中创建包

[英]I can't create bundle in symfony2

I have Windows 7 and WAMP localhost on drive D: . 我在驱动器D:上有Windows 7和WAMP localhost D: . I installed Symfony2 correctly. 我正确安装了Symfony2。 When I open http://127.0.0.1/Symfony/web/config.php I can see the Welcome! 当我打开http://127.0.0.1/Symfony/web/config.php我可以看到欢迎! message. 信息。 But in the tutorial "Creating Pages in Symfony2" when I want to create a bundle by this command: 但是当我想通过这个命令创建一个包时,在教程“在Symfony2中创建页面”中:

php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

This message appears: 出现此消息:

"php is not recognized as an internal or external command oprable program or batch file"

I don't know what I should do. 我不知道该怎么做。

You are receiving that error because PHP is not in your system PATH . 您收到该错误,因为PHP不在您的系统PATH Check out this quick tutorial on installing PHP on Windows. 查看有关在Windows上安装PHP的快速教程 Take note of Step 4 which is the installation step that should fix your problem. 请注意步骤4 ,这是应该解决问题的安装步骤。

Since you're using WampServer, the path you have to add to PATH will be something like this: 由于您使用的是WampServer,因此您必须添加到PATH如下:

"C:\Program Files (x86)\Wamp\bin\php5.3.10"

This is only an example, change the path to the actual path to PHP on your system. 这只是一个示例,将路径更改为系统上PHP的实际路径。 If the path has spaces in it (like Program Files (x86) does) it is helpful to always surround it with quotes ("). 如果路径中有空格(如Program Files (x86)那样),总是用引号(“)包围它是有帮助的。


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 . 更新:我最终与@reza一起进行了一个屏幕共享程序,并发现他不小心将他的PATH变量设置为D:\\php\\wamp\\bin\\php\\php5.3.10\\php.exe而不是D:\\php\\wamp\\bin\\php\\php5.3.10 Fixing this solved the problem. 解决这个问题解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM