Skip to content

Instantly share code, notes, and snippets.

@codeadamca
Last active May 18, 2026 04:51
Show Gist options
  • Select an option

  • Save codeadamca/09efb674f54172cbee887f04f700fe7c to your computer and use it in GitHub Desktop.

Select an option

Save codeadamca/09efb674f54172cbee887f04f700fe7c to your computer and use it in GitHub Desktop.
How to add new PHP versions to MAMP on a Mac

Adding Versions of PHP to MAMP on a Mac

If you're working on a project that requires a version of PHP higher than the versions that MAMP comes with, you can easily add additional verions.

My version of MAMP came installed with PHP 7.4.21 and 8.0.8. I'm attempting to use MAMP to host a Laravel application which requires at least PHP 8.1.

The version of PHP MAMP uses is often different than the version you have installed. I have installed PHP using Brew. I'm currently running PHP 8.1.8. If you want to check your installed version of PHP, use the terminal and run the following command:

php --version

terminal-php-version

  1. First we need to copy the installed PHP files to MAMP. Using Finder, navigate to /usr/local/Cellar/php and you should find a folder named after the installed version of PHP. For me it was 8.1.8. Copy this folder.

  2. Navigate to the folder that MAMP stores PHP versions. For me this was /Applications/MAMP/bin/php. Paste this folder here.

  3. Rename this folder to php8.1.8 (use your PHP version number).

  4. Next we need the PHP modile file. Navigate to /usr/local/lib/httpd and copy the modules folder. Inside this folder is the PHP module file names libphp.so.

  5. Navigate to /Applications/MAMP/bin/php/php8.1.8 and paste the modules folder.

  6. Close and restart MAMP.

  7. Choose PHP 8.1.8 from the frop down and you should be good to go!

mamp-php-8 1 8

I have a video walk-through on YouTube!

@stwrr
Copy link
Copy Markdown

stwrr commented Sep 22, 2024

If anyone else is having an issue with Php 8.3: You'll need a config folder for your 8.3 version. Go to /Applications/MAMP/conf Duplicate one of the previous php folders (like 8.1.13) rename to the name of your 8.3 version

Then go into the folder, edit the pear.conf replace all references of 8.1.13 with your 8.3 version

@simderoemer Hi, can you please explain in more detail what needs to be done to make it work with php 8.3?

@simderoemer
Copy link
Copy Markdown

Hi @stwrr I installed php 8.3 using homebrew then moved the folder across into /Applications/MAMP/bin/php
But there wasn't a /Applications/MAMP/conf/php8.3.8 folder, so I duplicated the config folder from 8.1 and made the changes emtioned above and this worked for me

@ShuaibBashiru
Copy link
Copy Markdown

another

You are right. I just made the same mistake

@CodeByLine
Copy link
Copy Markdown

hey, i don't have a "Cellar" folder inside my local folder

If you have a macbook M1 the folder will be inside opt/homebrew/Cellar ... I have also found the modules folder inside op/homebrew/lib/httpd/modules

That helped!

@CodeByLine
Copy link
Copy Markdown

This tip below finally resolved it for me!

For future visitors to this helpful gist, it sometimes helps to run sudo /Applications/MAMP/Library/bin/apachectl start from terminal, because that at least gives some hints as to where possible problems might be coming from. MAMP doesn't always log details for this error, but the terminal command shows where your .conf file is bad, for example.

@jgugelot
Copy link
Copy Markdown

jgugelot commented Apr 28, 2026

This is what i had to to do get it fixed (installing PHP8.3+8.4 on MAMP 6.8):

  • Be sure MAMP is in module-mode (not CGI-mode)
  • Install PHP version using brew: brew install php@{version}, copy new php folder(s) to MAMP: /opt/homebrew/Cellar/ to /Applications/MAMP/php
  • Copy /conf/* from another existing mamp PHP-version into the new-PHP version folder, edit pear.conf and php.ini and replace all references to the old version by the new version
  • Copy the folder /lib/httpd/modules into the root of the php-folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment