5

Yesterday I was working on my new Magento2 site and add new module after that I use SSH command and it was working perfectly but today morning I start working and start putty to run command but it's not working. if I run any command it's show me error that could not open input file : bin/magento.

First I run command php bin/magento setup:upgrade then php bin/magento setup:static-content:deploy also I run command related cache , indexing but same error I get all the time.

can anyone tell me why is it happening ? and how to solve this error message?

I checked in magento root folder that there is bin folder and within bin folder there is magento file.

5
  • Please check ssh user and sftp user are different ?
    – Amit Bera
    Jun 4, 2016 at 6:33
  • @AmitBera that is not a issue because I was working yesterday using same username and password.
    – Dhaval
    Jun 4, 2016 at 6:34
  • As per as,my concept it may permission issue for user. Try to give excute permission to` bin/magento` by find -L vendor/bin -type f -exec chmod u+x {} \;
    – Amit Bera
    Jun 4, 2016 at 6:38
  • revert the module and check again because I met the same issue while made mistake in registration.php (wrong module name). Jun 4, 2016 at 6:39
  • Also , Disable your module and run code
    – Amit Bera
    Jun 4, 2016 at 6:54

4 Answers 4

4

I don't know what have you done after adding some new code but i guess this is the issue cause your new code is not compiled. I am writing some command you should run after adding new code.

Go to the root folder of your Magento project and run the following commands :

sudo rm -rf var/cache var/generation var/di

sudo php bin/magento setup:upgrade

sudo php bin/magento setup:di:compile

sudo php bin/magento cache:clean

sudo chmod 777 -R var/

Hope it will solve your problem.

2

I faced this issue on windows and solved it by this command instead:

php bin\\magento setup:static-content:deploy

I doubled the \ to \\

1
  • not sure why, but it worked Oct 20, 2021 at 8:55
2

I too faced the same problem. But I was inside bin and typing

php bin/magento setup:upgrade

But instead of that I should type

php magento setup:upgrade

(NOTE: no bin required).

So check the path where you are in and point to bin folder magento file.

1

I was facing same issue. First of all you need to CD your magento installation direcotry. For example cd /my/magento/installation/directory and then run the command php bin/magento setup:upgrade;

2
  • This can also be done in the bin folder
    – Rebel
    May 5, 2017 at 21:57
  • No need to go in bin folder.. It happens due to chache.. Just you have to delete sudo rm -rf var/cache var/generation var/di then run your all commands..It solves the issue. Mar 20, 2020 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.