Skip to content

Instantly share code, notes, and snippets.

@kccogito
Last active December 23, 2022 01:56
Show Gist options
  • Save kccogito/bb33a0aa02e8bca2ce5ccabe5cad9008 to your computer and use it in GitHub Desktop.
Save kccogito/bb33a0aa02e8bca2ce5ccabe5cad9008 to your computer and use it in GitHub Desktop.
How to change or Add New PHP VERSION to MAMP and MAMP PRO - MAC

Adding NEW Versions of PHP to MAMP on a Mac

If you do not have php install already in your mac system use below command:

brew install php

then you can do which php

or

php -v or php --version

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 DRUPAL 10 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.13. If you want to check your installed version of PHP, use the terminal and run the following command:

php --version terminal-php-version

STEP ONE :

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.13. Copy this folder.

STEP 2:

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

STEP 3:

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

STEP 5:

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.

STEP 6:

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

FINAL

Close and restart MAMP.

Choose PHP 8.1.13 from the frop down and you should be good to go!

PLEASE SUBSCRIBE TO GET NEW UPDATE

mamp- php-8 1 13

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