5

How to add new PHP versions to MAMP on a Mac

 1 year ago
source link: https://gist.github.com/codeadamca/09efb674f54172cbee887f04f700fe7c
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK