10

I am trying to get MAMP runing with PHP 8.1 but what I see as latest version for MacOS is 8.0.8, is there a way to run 8.1 ?

I have gone thru many tutorials in which they explain on how to switch from one of the installed versions but I can't seem to find a way to install additional PHP versions.

Tomislav Tomi Nikolic
  • 608
  • 3
  • 10
  • 15
  • I also would like to know... Usually you just have to download a php version and add it to the bin/php folder – B. Rentrug May 29 '22 at 16:05

4 Answers4

14

following up relating to @Quink's answer

add additional php versions

8.1.0 is available in the dropdown (not in the picture because I already downloaded it)

then quit and restart mamp select 8.1.0

then you can find the folder by opening phpinfo page and seeing the path enter image description here

not sure if this is needed, but at this point I copied the folder and pasted it in the main MAMP/conf directory where all the other PHP versions are

jakebugz617
  • 319
  • 1
  • 11
12

I was looking for this myself. I found out that the easiest way to do this is to start your trial version of the pro. There you have the option to download/ install the php8.1 version. After this I switched back to the basic MAMP and everything is working properly

Quink
  • 121
  • 2
3

Install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

get latest php version i.e. 8.1 for now

brew install php

Verify php

which php
php -version

now go to to /usr/loca/Cellar/php, copy php version folder you want i.e. 8.1 for now go to Application/MAMP/bin/php and paste this folder

rename your folder like others i.e. "8.1.10_1" to "php8.1.10" in my case

at this point you can quite the mamp and reopen it and you will see php8.1 version in your mamp php version's dropdown

now go to your terminal and

/Applications/MAMP/Library/bin/apachectl start

and you will see an error i.e. Syntax error on line 160 of /Applications/MAMP/conf/apache/httpd.conf... in my case

to resolve this go to /usr/local/lib/httpd/ and copy the "modules" folder

now past it in /Applications/MAMP/bin/php/php8.1.10/

YOUR MAMP IS ALL SET BUT if you try to reach phpadmin you will see an error, for that

go to /Applications/MAMP/bin/phpMyAdmin5 and edit config.inc.php.

Locate this text: $cfg['Servers'][$i]['host'] = 'localhost' and change it to ``$cfg['Servers'][$i]['host'] = '127.0.0.1'`

Restart your server.

HOPE THIS HELP YOU

Junaid Masood
  • 658
  • 11
  • 20
  • I have MAMP but I can't see the version installed. When I type `which php` in the terminal, it says No `php not found`. Maybe because it was installed through a third party application like MAMP? – limakid Aug 12 '23 at 09:53
  • Yes, it is not available on your terminal then – Junaid Masood Aug 21 '23 at 11:27
2

This YouTube Video answers this perfectly, and then follow this SO answer

You might also want to change your local connection host from localhost to 127.0.0.1

PS: Copy /usr/local/Cellar/php/8.<version_number>/lib/httpd/modules/libphp.so to /Applications/MAMP/bin/php/php8.<version_number>/modules/libphp.so

Chuks Jr.
  • 393
  • 3
  • 7
  • Thank you for this sir; perfectly worked! But indeed only after changing `localhost` to `127.0.0.01`; do you actually know why?? – DevelJoe Aug 31 '22 at 12:48
  • I don't sadly :), I haven't had the time to investigate. @DevelJoe – Chuks Jr. Sep 04 '22 at 20:03
  • Typo, I obviously meant 127.0.0.1. Hmm I guess this can only be due to some cache like stuff of established connections, can't think of anything else – DevelJoe Sep 04 '22 at 21:07