32
$ cd my_project_name/
$ php bin/console server:run

When I added following commands and tried to run my symfony application this error comes,

"Error:Could not open input file: bin/console"

4
  • 12
    Try to execute php app/console server:run instead. Commented Dec 1, 2015 at 9:06
  • Commands are $ cd my_project_name/ $ php bin/console server:run Commented Dec 1, 2015 at 9:07
  • 5
    Symfony 3 was just released which moves the console command to the bin directory. The 'current' documentation now points to S3 instead of S2. You need to pick S2 on the documentation page to get the proper information: symfony.com/doc/2.8/book/index.html instead of symfony.com/doc/current/book/index.html Commented Dec 1, 2015 at 13:17
  • Obviously, you have to make sure you run this command from your application's folder - from anywhere else, and php obviously cannot find the file the command is pointing to. Commented Apr 21, 2017 at 15:50

7 Answers 7

31

As @chapay and @cered says we can use this command instead.

php app/console server:run

Its Symfony 2 command and the one I had problems with is Symfony 3 command. And I found out few other times also this issue comes.

for sometimes we can replace 'bin' with 'app'. like,

php bin/console doctrine:mapping:import --force AcmeBlogBundle xml
php app/console doctrine:mapping:import --force AcmeBlogBundle xml

And if not we can choose the correct command in 'http://symfony.com/doc/' site by changing the version.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

11

The file app/console was moved to bin/console in Symfony 3. So instead of running

php bin/console server:run      #valid in Symfony 3

Try running:

php app/console server:run      #valid in Symfony 2

Comments

6

Before to use this command make sure you installed dependencies from composer.json
Run:

composer update

1 Comment

better run composer install, you would not want to update dependencies and break something else
4

also make sure you are under the project folder (cd your_project), else it gives you the same error ( Could not open input file: bin/console )

1 Comment

Had transfered the symfony project under a src dir and that was the problem. Thanks!
3

It works when I use start instead of run : php app/console server:start

Comments

3

If you use git - you should check if bin/console is added to repository. Some versions may have .gitignore in bin/ folder, so bin/console may work on your local PC and not work on server because of it.

Comments

0

In Symfony 6, somehow the bin folder is still ignored from git, even though it should be there.

You can check my other answer here: https://stackoverflow.com/a/73958225/9675721

  • create a fresh new symfony application
  • copy the /bin folder
  • if it is missing, copy the /config/packages folder as well
  • add these lines to .gitignore:
    !/bin/
    !/config/packages/*

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.