Use Multiple PHP Versions in Parallel and Switch Flexibly
How it helps you
"As a web developer, I want to install and use different PHP versions on my local server for various projects in parallel — allowing me to run older applications with PHP 7.4 as well as new ones requiring PHP 8.3 or 8.4. This way, I can create compatible testing environments, safely test updates, and easily switch between multiple PHP versions without having to change my entire development setup.
Another advantage: I can match the exact PHP versions and configurations of my hosting provider to ensure that my website runs flawlessly in the live environment later on."
MAMP PRO allows you to install and use multiple PHP versions in parallel. This is ideal when maintaining projects with different requirements – for example, an older WordPress site that still needs PHP 7.4 and a new project that already supports PHP 8.3 or 8.4.
Tips & Best Practices
- Use the correct version per project: Configure each site to use the officially supported PHP version – matching your host’s specifications.
- Test upgrades: Create snapshots or blueprints before switching versions.
- Pre-releases for testing only: Alpha and beta versions are not suitable for production environments.
- Don’t forget to save: Changes take effect only after saving; servers will then restart automatically.
- Check CLI vs. web server: Make sure the CLI and web server are using the same PHP version.
Requirements
- MAMP PRO 7 or newer.
- Multiple PHP versions are installed or can be added.
Step-by-Step Guide
Check available PHP versions
- Open MAMP PRO → Settings → Languages → PHP.
- Here you can see all installed versions (e.g., PHP 7.4, 8.0, 8.3, 8.4).
- Use Add… to install additional versions.
MAMP PRO offers both stable releases and pre-release versions (e.g., PHP 8.5 alpha/beta) for testing.
Install additional PHP versions
- Click Add… in the list.
- Select the desired version (e.g., PHP 8.2, 8.5.0alpha).
- Click Install and then Save.
- The servers will restart automatically to make the new version available.
Note: Pre-release versions are not intended for production use and may have limitations (e.g., missing extensions or limited Xdebug support).
Set a global default version
- Go to Settings → Languages → PHP.
- Under Default Version, select your preferred default PHP version.
- Click Save; the servers will automatically restart.
Set a PHP version per site
- In the Sites list, open a site.
- Go to General → Hosts → PHP Version.
- Select the required version and click Save.
- The servers will automatically restart to apply the change.
This allows you to run multiple projects simultaneously with different PHP versions and precisely mirror your host’s environment.
Use the active PHP version in Terminal
- Go to Settings → Languages → PHP.
- Enable checkbox to active PHP version in terminal.
- Now, running
php -vin the terminal will show the PHP version currently active in MAMP PRO.
Why It Matters
With MAMP PRO, you can switch between multiple PHP versions at any time and install additional ones as needed. This gives you flexibility for maintaining older projects and preparing for new releases early — while allowing you to replicate your host’s exact PHP specifications locally for accurate live environment testing.