21

I installed wamp server and a copy of the Symfony2 framework. I am trying to create a Bundle, using the following command:

php app/console generate:bundle --nampespace=IDP/IDP_Bundle --format=yml

My PHP is in C:/wamp/bin/php/php5.3.10

But when I run the command it says:

could  not open input file app/console

Can anyone tell me what is going wrong?

0x1gene
  • 3,349
  • 4
  • 29
  • 48
Zoha Ali Khan
  • 1,659
  • 11
  • 37
  • 56

9 Answers9

44

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.

Community
  • 1
  • 1
Parixit
  • 3,829
  • 3
  • 37
  • 61
23

Dont run the command from the php path.

Add php into your path environment variable

and then cd to the project

C:/wamp/www/yourproject

and then run the command

php app/console generate:bundle --nampespace=IDP/IDP_Bundle --format=yml

It will work

Faryal Khan
  • 881
  • 4
  • 19
  • 37
9

For newer versions of Symfony (2.4.x or newer) use this method on windows to resolve the problem:

  1. Go to project directory e.g. d:/xampp/symfony2-project/ and open composer.json and place this under requires array "symfony/console": "2.4.*@dev". And save the file.
  2. Open command-line and cd to project's directory.
  3. Use this command to let download and install the dependencies: php path/to/composer.phar install. Remember you should be in your project's directory and path/to/composer.phar is the actual path to your composer.phar file.
  4. Now you are all done, just use php bin/console generate:bundle --namespace=Test/PrintBundle --format=yml
Imran Zahoor
  • 2,521
  • 1
  • 28
  • 38
3

Actually You need to be in your project root to run this command and you have to add php directory to your system env path variable.

  1. Add your php directory to the system path variable
  2. cd to the root of your project
Zoha Ali Khan
  • 1,659
  • 11
  • 37
  • 56
3

I'm use Symfony 3 and the Bundle calendar-bundle. This error is present in the documentation of: Bundle: https://github.com/adesigns/calendar-bundle

The form correct is:

php bin/console assets:install web 

Regards

juanitourquiza
  • 2,097
  • 1
  • 30
  • 52
1

First check the Environment Variable which is in Advanced system setting -> set path of C:/wamp/www/bin/php and then

run cmd->go to the directory of your project which is in www folder using cd C:/wamp/www/yourproject

use then user php app/console that shows the all command.

0

Sounds like you (i.e., your user) don't have access to read/execute console. I've never worked with with file permissions on a WAMP stack so I'm not sure what you'll need to do to fix them.

Peter Bailey
  • 105,256
  • 31
  • 182
  • 206
0

It is also possible that you have the line :

//umask(0000);

in your /web file, app_dev.php.

If after doing :

php app/console generate:bundle --nampespace=IDP/IDP_Bundle --format=yml

in your project path, you still can not generate your bundle, try uncommenting the unmask line. It worked for me.

hg8
  • 1,082
  • 2
  • 15
  • 28
0

I got the same issue when installing the pear library

my issue was, when downloading the go-pear.phar file, it downloads as the (.txt) extension which i didn't see.

jst change the file extension to .phar and run the code

Lahiru Pinto
  • 1,621
  • 19
  • 20