Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david001's avatar

upgrade PHP version on mac

I am using a mac. I need to install laravel so I want to upgrade to PHP 7.3 or higher I did brew install [email protected] and when I checked my PHP version in another terminal it still shows me PHP 7.2 .Again I run the command brew upgrade PHP, it gives me a warning

 brew upgrade php
Updating Homebrew...
Warning: php 7.4.11 already installed

but php -v shows me 7.2 . can anyone help me how to get php 7.4? Thanks

0 likes
11 replies
Snapey's avatar

make sure you close all instances of your terminal (including embedded in editors)

david001's avatar

I even restarted my computer. It shows PHP 7.2

david001's avatar

Thanks, @snapey for sharing the link. But it is not working. I hope you can help me. Based on the above article, these were the steps I have followed.

step1:

brew unlink php && brew link php I got this


Unlinking /usr/local/Cellar/php/7.4.11... 24 symlinks removed
Linking /usr/local/Cellar/php/7.4.11... 24 symlinks created

step 2:


cd ~
$ vi .zshrc

However, I have not got the following line in a terminal export PATH=/usr/local/php5/bin:$PATH

echo $PATH SHOWS

/usr/local/opt/[email protected]/sbin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/bin:/usr/local/php5/bin:/usr/local/php7.3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/php5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
jjoek's avatar

Try brew unlink php@72 and brew link php@74

note: remove the dot

david001's avatar

Error: No such keg: /usr/local/Cellar/php@72

1 like
shak's avatar

I just faced this same issue, but in my case, for some reason, when I run brew upgrade PHP, I get PHP is not installed, so I just ran brew install PHP and the problem was fixed

Please or to participate in this conversation.