Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not open input file: app/console (Symfony 2)

Recently I started working with Symfony2. Unfortunately the php app/console commands doesn't work at both my MAMP server as Vagrant server (MAC OSX). I tried to make a bundle with the following command

php app/console generate:bundle --namespace=Vendor/NameBundle

and also tried to fix a problem with

php app/console assets:install web

And both commands returned the following in my terminal:

Could not open input file: app/console

Does someone know how to fix this problem? I AM working at my project directory like: mac/applications/mamp/htdocs/project but it is still not working. I also tried to reinstall a new symfony project but that was not a fix. I guess my php isn't working at all in my terminal...

like image 302
Giesburts Avatar asked Dec 11 '22 19:12

Giesburts


2 Answers

So the problem was the version number. Symfony version 3.0 is available now so if you're do not selecting a version number at your project install it will automaticly install version 3.0 instead of 2.7. The new command is:

$ php bin/console generate:bundle --namespace=Vendor/NameBundle

instead of

$ php app/console generate:bundle --namespace=Vendor/NameBundle
like image 165
Giesburts Avatar answered Dec 25 '22 08:12

Giesburts


  1. Add php to your Path Environment Variable so that you can execute php from the command line
  2. (You may need to restart your computer after step 1) From the command line type: php -version to test whether php has successfully been added to your pathenvironment variable
  3. Depending on the version of Symfony you have, you will need to execute either php app/console or php bin/console where console is a php file inside the app or bin directories in your project root. To check which command to use, look into your project directories, if bin/ directory is present then execute php bin/console as console.php is located in that directory.
  4. From the command line, cd into your project root directory and run the appropriate command as mentioned above. To check whether you are in the correct directory, run the dir command, if all your Symfony project directories: app/, bin/, src/, vendors/ etc. are displayed, then the php app/console (bin/console) ... command should run successfully.
like image 42
Charles Avatar answered Dec 25 '22 09:12

Charles