DEV Community

Cover image for Upgrade PHP 7.4 with Homebrew
David Carr
David Carr

Posted on • Originally published at daveismyname.blog

Upgrade PHP 7.4 with Homebrew

PHP 7.4 came out this week, so it's time to upgrade!

On Mac, Homebrew makes the whole process painless.

First, run an update on Homebrew:

brew update
Enter fullscreen mode Exit fullscreen mode

You will see any tabs available if you've updated recently then its likely you'll only see:

Updated 1 tap (homebrew/core).
==> New Formulae
php@7.3
Enter fullscreen mode Exit fullscreen mode

Next upgrade PHP:

brew upgrade php
Enter fullscreen mode Exit fullscreen mode

This will upgrade PHP to the latest version, which at this moment is PHP 7.4

To verify your PHP version run:

php -v
Enter fullscreen mode Exit fullscreen mode

Then you should see:

PHP 7.4.0 (cli) (built: Nov 29 2019 16:18:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
Enter fullscreen mode Exit fullscreen mode

That's all there is to it!

Top comments (2)

Collapse
 
kp profile image
KP

@daveismynamecom
I see this error:

$ brew upgrade php
Error: php not installed

Any ideas?

Collapse
 
colorsvn profile image
Petr Nguyen • Edited

I setup fresh Mac OS with Catalina version. I need setup alias

alias php="/usr/local/bin/php"

I agree guide line of you work fine when upgrade Mac Os to Catalina version.