MAMP currently allows selection of the two latest versions of PHP, which at the time of writing this article are PHP version 8.0.1 and 8.1.0.
But, very often PHP projects, like WordPress websites are built using older version of PHP and will not work with the latest versions of PHP.
Check PHP version in MAMP
First, let see how to check the version in MAMP.
Basically, you go to MAMP menu and then click on “Preferences…”.
In the “Preferences” windows, click on the “PHP” button and there you will see which PHP versions are available to select in the “Version” drop-down menu.
Add additional PHP versions to MAMP?
Now, to add additional PHP version or change the PHP version 8.0.1 and 8.1.0 with two older versions of PHP it is pretty easy.
First, you go to the PHP folder of MAMP.
You will find the PHP folder if you go to your MAMP installation folder. Next go to the “bin” folder and then look for the “php” folder.
So the path is: MAMP installation folder > bin > php.
In the php folder you will see more than two php versions.
To replace the existing PHP versions with two other version, you just have to rename the folders of the PHP versions you don’t want to see and add any character.
Since, I don’t want to see php8.0.1 and php8.1.0, I will add an “x” character at the end of the folder names, and now the folders will be “php8.0.1x” and “php8.1.0x” respectively.
And now, if you re-open MAMP and restart the Apache Server and MySQL Server,
and go to the PHP menu as above, you will see two different PHP versions, which you can choose from.
Note: before renaming the php folders, make sure that MAMP is closed and the Apache and MySQL servers are stopped. Once you rename them, then go ahead and start MAMP and the servers.
In this tutorial you learned how to add additional PHP versions to MAMP. Sometimes older versions of PHP are required for our projects to work properly.
Hopefully it was helpful to you.
Thanks for reading the tutorial and see you next time!