How can I add additional PHP versions to MAMP

PhpMacosMamp

Php Problem Overview


The current version of MAMP that I have only has php 5.2.17 and 5.4.4. I need 5.3.X. Is there a way to add additional versions that can be selected in the MAMP interfaces php preferences? This is for the free version of MAMP, not MAMP PRO.

Thanks

Php Solutions


Solution 1 - Php

Found a quick fix in the MAMP forums.

Basically it seems MAMP is only allowing 2 versions of PHP to show up. Quick fix, rename the folders you're not bothered about using, for me this meant adding an "X" to my /Applications/MAMP/bin/php/php5.4.10_X folder. Now 5.2.17 and 5.3.20 show up in the mamp prefs.

Done!

Edit - if the PHP version you require isn't in the PHP folder, you can download the version you require from http://www.mamp.info/en/downloads/

Edit - MAMP don't seem to provide links to the alternative PHP versions on the download page any more. Use WayBackMachine https://web.archive.org/web/20180131074715/http://www.mamp.info/en/downloads/

Solution 2 - Php

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!

Solution 3 - Php

MAMP takes only two highest versions of the PHP in the following folder /Application/MAMP/bin/php

As you can see here highest versions are 7.0.10 and 5.6.25 MAMP php Versions 7.0.10 and 5.6.25

Now 7.0.10 version is removed and as you can see highest two versions are 5.6.25 and 5.5.38 as shown in preferencesphp versions 5.6.25 and 5.5.38

Solution 4 - Php

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.

Solution 5 - Php

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.

Solution 6 - Php

I'm using the free version of MAMP on mac (27 of April of 2021, MAMP version 6.3) and the @LiveSource answer helped me to find a solution.

My MAMP is not showing more than 2 option on the dropdown and on the /Applications/MAMP/bin/php has 7 options of PHP version. So the MAMP will display the latest 2.

To solve it I changed the name of all PHP version folders that I would not like to use. This way only 2 folders will be compatible with MAMP and my desired versions will display on the dropdown.

I added a _X in the end but you can add anything.

After doing the change, close the MAMP and open it again.

See the screenshots of the solution working.

enter image description here

enter image description here

Solution 7 - Php

The easiest solution I found is to just rename the php folder version as such:

  1. Shut down the servers
  2. Rename the folder containing the php version that you don't need in /Applications/MAMP/bin/php. php7.3.9 --> _php7.3.9

That way only two of them will be read by MAMP. Done!

Solution 8 - Php

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:

MAMP PRO --> Preferences

enter image description here

enter image description here

enter image description here

Solution 9 - Php

Honestly try using Docker had such a headache with MAMP and php versions.

Use this to get it up and running its simple.

https://github.com/harshalone/docker-compose-lamp

git clone https://github.com/harshalone/docker-compose-lamp.git
cd docker-compose-lamp/
cp sample.env .env
// modify sample.env as needed
docker-compose up -d
// visit localhost

In the bin folder you will see your php versions.

enter image description here

Change the version you want to use in your .env file PHPVERSION=php7.4

You can watch this tutorial. Wish I had started using docker earlier it will save you a tonne of issues and time.

https://www.youtube.com/watch?v=MTeY3npy1gU

Solution 10 - Php

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLiveSourceView Question on Stackoverflow
Solution 1 - PhpLiveSourceView Answer on Stackoverflow
Solution 2 - PhponedotoverView Answer on Stackoverflow
Solution 3 - PhpKrishnamoorthy AcharyaView Answer on Stackoverflow
Solution 4 - PhpioCronView Answer on Stackoverflow
Solution 5 - PhpMarianneView Answer on Stackoverflow
Solution 6 - PhpRafael PerozinView Answer on Stackoverflow
Solution 7 - PhpJosep AlsinaView Answer on Stackoverflow
Solution 8 - PhpChris SView Answer on Stackoverflow
Solution 9 - Phpuser1503606View Answer on Stackoverflow
Solution 10 - PhpAlexView Answer on Stackoverflow