Just uninstall and when installing just specify the version
brew install [email protected]
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there any way to install php 7.2 instead of installing php 7.3 when running
brew install php ?
Is there any way to downgrade from php 7.3 to php 7.2 after running brew install php ?
Hi @thavarshan
I ran into a similar issue last week.
This is what I did, and I hope this works for you.
Download the following script: https://gist.github.com/dannygsmith/5b74ba708d7bf8621c1cb6b959ece99f/
Run it.
Then do the following steps below.
Update homebrew & upgrade
brew update
brew upgrade
Install php
brew install [email protected]
Install the required PHP to your PATH
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Then make sure it's all working
php --version
This command will show you where your ini file is loaded
php --ini
However, I got my valet setup to work with PHP 7.3 using the same steps. So I think it should work if you follow the same steps.
Goodluck, and please let me know if this at least guides you on the right path.
Please or to participate in this conversation.