There can be many reasons why you need to switch your active version of PHP. Testing your code with different versions for backwards compatibility, or perhaps some applications use deprecated functions not available in the latest release of PHP. Whatever the reason if you use Homebrew on mac to manage your PHP switching it up is easy.
Simply run the brew unlink php
to remove the current version of php and run brew link --force --overwrite [email protected]
to link a new version of course you can substitute 7.4 for any version you desire. Putting it all together we get the following compound command.
brew unlink php && brew link --force --overwrite [email protected]
Featured Image: Photo by Mikhail Nilov from Pexels