How to switch between several PHP versions in MAMP 2.x

- by

mamp logoSometimes you need to test your projects against multiple versions of PHP.

If you’re using MAMP that’s fairly easy to do: head over to the MAMP Start Screen, select Preferences and see two versions to choose from.

Here I’m using MAMP 2.2 (even though 3.x has been released already) and I have PHP 5.2.17 and PHP 5.5.3.

When I switch to the other version MAMP restarts and I can refresh my browser to see my project running on the other PHP version.

Screen Shot 2014-03-20 at 08.31.06

Screen Shot 2014-03-20 at 08.31.12

That’s all good if I actually needed either version – but sadly 5.2.x is too old for me, and 5.5.x doesn’t quite work and is a bit too cutting edge. I need it to reflect my production environment.

So what is a boy to do?

The good news is that MAMP ships with several other PHP versions, and you can even download more from (in the downloads section). Only two versions are displayed at a time, namely the oldest and the newest you have in a certain directory.

To make use of this feature, shut down MAMP, then find the correct folder and simply rename the versions you don’t need to something else – for example, add an x to the front. Open a Finder window and navigate to the following folder:

  • Applications/MAMP/bin/php

This is the folder that houses all your PHP versions. You’ll see something similar to this:

Screen Shot 2014-03-20 at 08.39.40

I’m renaming my oldest version and my newest version so that I’m left with PHP 5.3.27 and PHP 5.4.19:

Screen Shot 2014-03-20 at 08.43.14

Now restart MAMP and see your handy work in action. You’ll be pleased to see that you can now choose the PHP version you actually want to use:

Screen Shot 2014-03-20 at 08.50.52

I understand this hack is no longer necessary in MAMP 3 which offers better PHP version management.

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

5 thoughts on “How to switch between several PHP versions in MAMP 2.x”

  1. Hello, anyone tried to update and use PHP > 5.5.3 in MAMP 2.2 ?
    Would like to keep MAMP 2.2 and add a newer PHP version on my older laptop/OSX.
    Thanks in advance.

  2. Hi pepperstreet, I’ve only tried older versions and they worked a treat, 5.5.3 came pre-installed with MAMP and also worked well. I can also tell you that when you install MAMP 3, it will install itself alongside MAMP 2 so if you want to try even newer versions of PHP, see if MAMP 3 works for you (and if not, simply keep using MAMP 2).

    Hope this helps!

Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.