Home > Back-end >  zsh: command not found: php
zsh: command not found: php

Time:10-31

I have been using php with mamp on mac for a year even with old versions of MacOS, since I installed MacOS Monterrey if I type php on the terminal I get a message:zsh: command not found: php

Using older versions of MacOS I have never had this problem.

How can I solve the problem?

CodePudding user response:

You probably need to fix it in the .bashrc file.

Do this:

Open the terminal and run this command:

nano ~/.bashrc 

Then add this line in the .bashrc file:

export PATH=$PATH:/usr/share/php/bin

Save and exit (ctrl x)

CodePudding user response:

I had the same issue after updating to Monterry. After some googling, I find out MacOS doesn't include PHP. You need Homebrew to install PHP again.

brew install php

https://daily-dev-tips.com/posts/installing-php-on-your-mac/

  • Related