PHP 7.3 reached end of life on 06 Dec 2021 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.
Open Terminal
open -a Terminal
Update Homebrew
brew update
Install PHP 7.3
brew install [email protected]
Link PHP 7.3
brew link [email protected]
Add PHP to your PATH
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Check PHP version
php -v
You should see output indicating PHP 7.3.x is installed
Verify PHP configuration
php -i
This will display detailed PHP configuration information
Test PHP execution
php -r "phpinfo();"
This should output PHP information without any errors