I Have installed MAMP in my mac, Using the php version of 7.4.
command which php
returns - /Applications/MAMP/bin/php/php7.4.21/bin/php
I have installed php 8.1 using brew. I comment the ~/.bash_profile
# export PATH=/Applications/MAMP/bin/php/php7.4.21/bin:$PATH
# alias mysql=/Applications/MAMP/Library/bin/mysql
# export PATH="/usr/local/opt/node@13/bin:$PATH"
but still its show the same php path . How to shift to newly installed php version?
You have to link which version of PHP you want to use.
brew unlink php
will unlink the current version of PHP.
brew link php@8.1
will link with PHP 8.1 (you need to install it before)