When we want to switch to a PHP version on MacOS we need to use these commands. Just a few simple steps will help us switch from PHP 7 to PHP 8 on Mac.
#1 Install Brew PHP Switcher
First we need to install brew-php-switcher and we will run this command:
brew install brew-php-switcher
Next you can check your installed php versions by using this command:
brew search php
We will use the following command to switch from PHP to MacOS
We are switching to PHP 8 from the previous version.
You can try other versions as well which is perfectly fine just make sure to type the right version of PHP you want to switch on Mac.