I've followed this guide to install Homebrew on an M1 based Mac.
After that I ran
brew install [email protected]
which installed PHP successfully.
If I now run
brew upgrade php
I get
Error: php not installed
What I like to achieve is to update the PHP that comes shipped with macOS, which is 7.3.22 when I run php -v.
How can I update PHP using Homebrew? I understood that I need to put something in my PATH to point to the newer PHP version? Given this is a new machine I actually don't have a .bash_profile file, only a .zshrc (I'm using ZSH, I assume that this file will be used and that I don't need a .bash_profile?)
It's not advisable to upgrade the system-provided PHP, but it's also not necessary.
brew link can be used to decide which PHP is utilized. brew link [email protected] should do the trick; this can be also used to switch PHP versions around, i.e. brew link [email protected] will switch you over to that while leaving both versions installed and available directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With