Since I had to face this issue as well, let me share how to make this work. If you have to switch back and forth on mac then this is what works for me.

Let’s say you have multiple PHP versions installed 7.2 and 7.4

Now my current PHP version is 7.4 & I have to switch back to 7.2, steps will be.

  1. brew unlink php@7.4 && brew link php@7.2 --force
  2. nano ~/.zshrc -> Update Export Path From 7.4 to 7.2

3. Save It.

4. brew services stop php@7.4

5. brew services start php@7.2

Voila. To go back to 7.4 Run brew unlink php@7.2 && brew link php@7.4 --force & uncomment export files. That's it.

references: https://stackoverflow.com/questions/59142504/switch-of-php-versions-not-working-on-mac

--

--

Budiaramdhan Rindi

Currently work as Coder since 2011 and still have to learn. Dota 2 and Football Manager are the games I still play to stay fresh.