I created module magento 2,but module can't run and errors exist Please upgrade your database: Run "bin/magento setup:upgrade from the Magento root directory. "

i tried to run command bin/magento setup:upgrade but not success, appeared another error:

bin/magento setup:upgrade /usr/bin/env: ‘php’: No such file or directory 

I am using window 10.


Try to run this command from the root directory :

php bin/magento setup:upgrade

after upgrade you can flush the cache:

php -f bin/magento cache:flush
  • thanks for answer but it errors same this: bash: php: command not found – Simple Jun 24 '16 at 10:27
  • Make sure your syntax , naming convention and everything is fine. check if there is any typo mistake and check the logs . Often this is caused by typo, Still exists !!!, post your module code for reference. – Krishna ijjada Jun 24 '16 at 10:32
  • pls help me check this code: github.com/quangnghiasl995/magento2-helloworld i think code correct – Simple Jun 24 '16 at 11:08
  • Try adding the path to php. Run which php to find the path. – Steve Johnson Jun 26 '16 at 12:21
  • @Manashvi birla thanks for reply ....its working for me – Sarvesh Tiwari Feb 17 '17 at 7:21

I hope this will help you

If you are using wamp server on windows then

C:\wamp\bin\php\php5.5.12>php.exe C:\wamp\www\<Magento root directory>\bin\magento setup:upgrade in your CLI.

  • 2
    im using xampp git bash in xampp/htdocs/magento root directory/ then run command bin/magento setup:upgrade – Simple Jun 24 '16 at 10:59

I follow these steps to solve this issue on my project (reference source: https://magentoexplorer.com/please-upgrade-your-database-run-binmagento-setupupgrade-from-the-magento-root-directory)

Step 1 Remove unused module table from database. enter image description here

Only remove modules that are not installed on your magento store

Step 2. Go to your Magento 2 root folder and open the Git Bash. Run the following command from your ssh command interface

bin/magento setup:upgrade


php bin/magento cache:clean
php bin/magento indexer:reindex
php bin/magento setup:static-content:deploy

Hope this helps with your situation

  • what is this table,if you include the table name it would be great understanding for reader – Mujahidh Aug 30 '17 at 11:56
  • The table is called setup_module if you still need it :p – Greg Mar 20 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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