macos - zsh: command not found: php
Get the solution ↓↓↓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 typephp
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?
Answer
Solution:
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/
Answer
Solution:
When I update MacOS Monterey, PHP was remove. I found this article it useful and solve this problem for me. https://wpbeaches.com/updating-to-php-versions-7-4-and-8-on-macos-12-monterey
Add the PHP formulae
brew tap shivammathur/php
Choose the PHP version – this example uses 7.4
brew install shivammathur/php/[email protected]
Link the PHP Version
brew link --overwrite --force [email protected]
Restart the Terminal
php -v
Answer
Solution:
I have same problem and this is the solution that I use for this.
install Xcode using your terminal
xcode-select --install
install homebrew using your terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
when it finish the process you need to add the homebrew in your path and for this put this code
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/**xxxxxxx**/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
xxxxxxx write your user name
now you can check if homebrew is run correctly, use the next code.
brew --version
you can see in the terminal the version that you have install in your pc
now is time for install php for this
brew install php
finally, you can try see the version of php installed
php --version
Answer
Solution:
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
)
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: 403 this action is unauthorized.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.