vimuth
vimuth

Reputation: 5602

"Could not open input file: bin/console" Error comes when try to Run the Symfony Application

$ 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"

Upvotes: 30

Views: 111357

Answers (7)

Raphael Pinel
Raphael Pinel

Reputation: 2780

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/*

Upvotes: 0

vimuth
vimuth

Reputation: 5602

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

Upvotes: 32

Andrew Zhilin
Andrew Zhilin

Reputation: 1708

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.

Upvotes: 3

Inoubli
Inoubli

Reputation: 374

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 )

Upvotes: 4

Alex2024
Alex2024

Reputation: 81

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

composer update

Upvotes: 6

Rowayda Khayri
Rowayda Khayri

Reputation: 489

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

Upvotes: 3

Lucian P.
Lucian P.

Reputation: 316

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

Upvotes: 11

Related Questions