PHP app\console wont work trying to create bundle for Symfony 2

梦想的初衷 提交于 2019-12-12 09:13:35

问题


I have installed Symfony2 on a Xampp server with PHP 5.3.8 and everything works ok ( the php, the symfony demo page ).

I try to create my own helloWorld, as the tutorial says :

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

I go Start->Run->CMD and put that line of code and it gives me back this :

could not open input file : app/console

I put the PHP directory to the System PATH but the problem persists.


回答1:


To execute command you should move to root directory of your project in terminal/CMD.

Please note that in version 2.5 some changes has been made so command will not work with app/console

Note: From 2.5 app/console is replaced by bin/console.

Please check here for changes. Also check this for more details about difference.




回答2:


Most probably, you're not in the symfony2 project directory.

  1. start the windows console as you're doing it (Start->Run->CMD)
  2. then move to the symfony2 project root directory with the command cd: "cd c:\htdocs\path\to\your\symfony2\project"
  3. then run the command from the tutorial

the thing is that the part of the command from the tutorial "app/console" means the path to the "console" script in the "app" directory of the symfony2 project.



来源:https://stackoverflow.com/questions/10045352/php-app-console-wont-work-trying-to-create-bundle-for-symfony-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!