Hello,
Use which php in the terminal to see which version of PHP you are using.
If it's not the PHP version from MAMP, you should edit or add .bash_profile in the user's home directory, that is : cd ~
In .bash_profile, add following line:
export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
Then,you should use command cd /Applications/MAMP/bin/php to check which PHP version from MAMP you are using and then replace with the PHP version above.
Then restart the terminal to see which PHP you are using now.
And it should be working now.
Thank You!!