40

I downloaded MAMP 4.1 on my Mac; by default, the only PHP versions I can use are 7.0.15 and 7.1.1

How can I use PHP 5.6?

I tried the solution here Which says I should rename the versions I don't want to use to something else. But it didn't work for me.

screenshot of MAMP preferences

Robin Daugherty
  • 7,115
  • 4
  • 45
  • 59
Ilo Calistus
  • 2,005
  • 3
  • 19
  • 23
  • try some thing like `brew install php56` or refer to this [link](https://ryanwinchester.ca/posts/install-php-5-6-in-osx-10-with-homebrew) – Yu Jiaao Mar 31 '17 at 09:58
  • 4
    Your here is the right link. Use the bottom answer to rename the bin/php directory. The MAMP preference pane will show the 2 latest versions in the php directory. – Scott Eisenberg Mar 31 '17 at 21:13
  • You included a link to the answer you're looking for. "But it didn't work for me" doesn't help us answer your question. – Robin Daugherty Jun 05 '17 at 15:25

3 Answers3

78

As mentioned by @Scott in the comments under your question:

Your here is the right link. Use the bottom answer to rename the bin/php directory. The MAMP preference pane will show the 2 latest versions in the php directory. – Scott Eisenberg

And the answer in that links is:

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.

In my case (and similarly yours), I renamed the folder named php7.1.1 to _php7.1.1 and now MAMP shows me 5.6.30 and 7.0.15 in the preferences pane.

Armin
  • 1,807
  • 20
  • 21
  • Does anyone know a way of having MAMP show 2+ PHP versions at once? – Bert H Sep 12 '17 at 07:28
  • 1
    @BertH To this date, the current MAMP version does not allow more than two PHP version selections. That's where MAMP Pro comes in. It allows configuration for more than one virtual hosts (and goes without saying multiple PHP versions). – Armin Oct 04 '17 at 07:30
22

This is how my 'php' folder look like

Current php folder

Created another folder 'php-versions' and moved all versions, and kept only two version which I wanted in the 'php' folder. And restarted the Mamp, go the version '5.6.31'

Later my 'php' folder

Raghava Kotekar
  • 471
  • 5
  • 8
5

I am using MAMP version 4.5. I changed php version on the httpd.conf:

/Applications/MAMP/conf/apache/httpd.conf

I wanted to the version to php7.1 so here is what I did:

Original line:

LoadModule php7_module        /Applications/MAMP/bin/php/php7.2.1/modules/libphp7.so

Updated line:

LoadModule php7_module        /Applications/MAMP/bin/php/php7.1.12/modules/libphp7.so

It worked for me!

alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46
Sakthi V
  • 59
  • 1
  • 4
  • 1
    value will be overwrite after restart mamp. This one is working for me. https://stackoverflow.com/questions/16783558/how-can-i-add-additional-php-versions-to-mamp#answer-19504217 – Wenping Guo Oct 18 '18 at 05:09