DEV Community


Posted on

Upgrading from PHP@7.3 to PHP@7.4 on Mac

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

Top comments (1)

leslieeeee profile image

If you are macOS user, is a good tool, especially for the beginners. It handles all PHP, MariaDB, PostgreSQL versions, plus Redis and Memcached. Run multiple PHP instances simultaneously and switch easily. This tool has made my PHP dev simpler. Worth a shot!