DEV Community


Upgrading from PHP@7.3 to PHP@7.4 on Mac

Full Stack Web Developer
・1 min read

brew install php@7.4
To find the compiler just installed run sudo find / -name php
To check this is the compiler run:
/usr/local/Cellar/php@7.4/7.4.14_1/bin/php -v
Add the compiler to you PATH by editing your .zshrc file (in ~/.zshrc):
export PATH="/usr/local/Cellar/php@7.4/7.4.14_1/bin/php:$PATH"
Make sure that the php PATH is above you composer PATH, otherwise composer will look at your Mac’s default php which is at v7.3 i.e:

export PATH="/Users/stuardcreed/.composer/vendor/bin:$PATH"
export PATH="/usr/local/Cellar/php@7.4/7.4.14_1/bin/php:$PATH"

run source ~/.zshrc to implement the changes

Discussion (0)