I have setup Magento2 on my local system but when i go to git bash and run any command i am getting this error bash: php: command not found.

  • instead of php add path of your php in commad – Piyush Jan 30 '18 at 6:34

Use this command :

$whereis php

O/P (will be like blow):

**php: /usr/bin/php7.0**

Go to your Magento root Directory and use below command :

/usr/bin/php7.0/php bin/magento cache:flush

If you are using windows then, follow this :

php to the path environment variable


| improve this answer | |
  • /usr/bin/env: php’: No such file or directory – imtiaz Jan 31 '18 at 6:52
  • What is the output of this command ? $whereis php – Saphal Jha Jan 31 '18 at 7:47
  • please run below command : $which php ,Then you will get a path like below "/usr/bin/php" ,then run the command : /usr/bin/php bin/magento cache:flush – Saphal Jha Jan 31 '18 at 7:58
  • which php which: no php – imtiaz Feb 1 '18 at 6:03
  • Try : $php -v -is any command working for php on ssh? – Saphal Jha Feb 1 '18 at 7:10

On my server there are multiple php version, for magento commands I use php71 bin/magento .... You can try php70 (version 7.0) or php71 (version 7.1)

| improve this answer | |

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.