Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been using MAMP for quite some time for my personal web development work. It's a great App but sometimes it feels like it is dumbing down some things a little bit too much. Selecting which PHP version that is used is one of those. It appears that MAMP only gives you the option of picking the latest two PHP versions that it ships with...
phpmamp_1.png


However, you're not limited to using just those two! In fact, if you check the MAMP php directory (/Applications/MAMP/bin/php) you will see that there are multiple other versions of PHP installed there.

So in my case, MAMP had PHP 7.1.1 as the default version and the only other available choice in the UI that it was giving me was version 7.0.15. I didn't want to use PHP 7.x at all since my server was still on 5.6.x. However, MAMP came with PHP 5.6.30 but wasn't giving me the option to select it.

Fortunately you can force MAMP to allow you to select the versions of PHP that you want to use with a few directory renames!
phpmamp_2.png




The trick is to rename whichever version of PHP you do not wish to use by putting an underscore (_) character in front of the original directory name. This is done in the MAMP php directory (/Applications/MAMP/bin/php). Rename all but the two versions you are interested in using and restart MAMP. After restarting you will be able to pick either of the two versions that you didn't rename.

In my case, I renamed all versions except 7.1.1 and 5.6.30. Now I can select between PHP 5.6 and PHP 7.1 development environments.
phpmamp_3.png


I've not tried this, but if you need a completely different version of PHP that isn't shipped with MAMP, you should be able to just add it to the MAMP php directory and select it as if it was one of the shipped versions, just follow the steps above to ensure MAMP lets you select it. Also follow the naming convention used my MAMP or it won't recognise that you've added a new PHP version.

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.