First stop the Server if its running. Go to "/Applications/MAMP/bin/", rename the PHP Version you don't need (MAMP is only allowed to use 2 PHP Versions), e.g. "_php5.2.17". Now MAMP will use the php versions that are left. Go to the MAMP Manager and then settings, then switch to the php version you need.
One problem with this solution I encountered was the httpd process (took me a while to figure that out xD). If you have the httpd process running in the background, then the php switch won't work, until you stop those processes (sometimes MAMP has an awkward problem to stop the server, thats why this process can be still alive). Start your Activity Monitor on your Mac (Shortcut: Press Command+Space and type in activity...), go to the Search Function and type in "httpd", close all those processes. Now you should be able to switch your PHP Version with the MAMP Manager.
The file /Applications/MAMP/bin/mamp/mamp.conf.json holds the MAMP configuration, look for the section:
{
"name": "PHP",
"version": "5.6.28, 7.0.20"
}
which lists the the php versions which will be displayed in the GUI, obviously you need to have downloaded the PHP version from the MAMP site first and placed it in /Applications/MAMP/bin/php for this to work.
The easiest solution I found is to just rename the php folder version as such:
That way only two of them will be read by MAMP. Done!
If you need to be able to switch between more than two versions at a time, you can use the following to change the version of PHP manually.
MAMP automatically rewrites the following line in your /Applications/MAMP/conf/apache/httpd.conf file when it restarts based on the settings in preferences. You can comment out this line and add the second one to the end of your file:
# Comment this out just under all the modules loaded
# LoadModule php5_module /Applications/MAMP/bin/php/php5.x.x/modules/libphp5.so
At the bottom of the httpd.conf file, you'll see where additional configurations are loaded from the extra folder. Add this to the bottom of the httpd.conf file
# PHP Version Change
Include /Applications/MAMP/conf/apache/extra/httpd-php.conf
Then create a new file here: /Applications/MAMP/conf/apache/extra/httpd-php.conf
# Uncomment the version of PHP you want to run with MAMP
# LoadModule php5_module /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.3.27/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.4.19/modules/libphp5.so
LoadModule php5_module /Applications/MAMP/bin/php/php5.5.3/modules/libphp5.so
After you have this setup, just uncomment the version of PHP you want to use and restart the servers!
Maybe easy like this?
Compiled binaries of the PHP interpreter can be found at http://www.mamp.info/en/ downloads/index.html . Drop this downloaded folder into your /Applications/MAMP/bin/php! directory. Close and re-open your MAMP PRO application. Your new PHP version should now appear in the PHP drop down menu. MAMP PRO will only support PHP versions from the downloads page.
Additional Version of PHP can be installed directly from the APP (using MAMP PRO v5 at least).
Here's how (All Steps):
MAMP PRO --> Preferences --> click [Check Now] to check for updates (even if you have automatic updates enabled!) --> click [Show PHP Versions] --> Install as needed!
Step-by-step screenshots:
Source: Stackoverflow.com