Magento2 SSH – SSH Could Not Open Input File: bin/magento

magento2ssh

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.

Best Answer

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.