PHP versions
Why multiple PHP versions exist
Section titled “Why multiple PHP versions exist”PHP releases new major versions every few years, with regular minor updates and patches in between. Each major version introduces changes that can break existing code – functions are renamed, removed, or changed in behavior. As a result, different projects often require different PHP versions:
- A WordPress site from 2019 may require PHP 7.4
- A modern Laravel application may require PHP 8.2 or higher
- A legacy system may be stuck on PHP 7.1
Many hosting providers let you choose a PHP version per site or virtual host – and MAMP PRO mirrors exactly this capability on your local machine. Each site can run its own PHP version independently, making it easy to replicate the exact server environment of each project.
How MAMP PRO manages PHP versions
Section titled “How MAMP PRO manages PHP versions”MAMP PRO ships with a range of PHP versions pre-installed under /Applications/MAMP/bin/php/. Each version is a complete, self-contained PHP installation with its own set of extensions and its own php.ini configuration file.
You select the PHP version for each site individually in the site settings under Sites › [site name] › General › Basic → PHP version. The available options depend on which versions are installed.
The Default PHP version
Section titled “The Default PHP version”Every site has two options for its PHP version:
- Default (x.y.z) – The site uses whatever version is currently set as the global default in Settings › Languages › PHP. If you change the default, all sites set to “Default” update automatically.
- A specific version – The site is pinned to that version regardless of what the default is.
This distinction matters in practice. If you have ten sites and you update the default PHP version to test compatibility, all sites on “Default” switch at once. Sites pinned to a specific version are unaffected. Use “Default” for new projects you actively maintain; use a pinned version for legacy code that must not change.
php.ini configuration per version
Section titled “php.ini configuration per version”Each PHP version has its own php.ini file located at:
/Applications/MAMP/bin/php/phpX.Y.Z/conf/php.iniIn MAMP PRO, PHP settings must be edited via the Template Editor (File › Open Template › PHP). Editing php.ini directly has no effect – the file is regenerated from the template every time the servers restart.
Common settings you might need to adjust:
| Setting | What it controls |
|---|---|
memory_limit | Maximum memory a script can use |
upload_max_filesize | Maximum file size for uploads |
post_max_size | Maximum size of POST data |
max_execution_time | Maximum time a script may run |
xdebug.mode | Xdebug operating mode |
Checking the active PHP version
Section titled “Checking the active PHP version”To confirm which PHP version a site is currently using, see How can I check the local PHP settings?
PHP extensions and modules
Section titled “PHP extensions and modules”Each PHP version comes with a set of pre-compiled extensions. To see which extensions are active for a given version, call phpinfo() or open WebStart → Tools → phpInfo.
If you need an extension that is not included, you can install it via PECL. See Install a PHP extension using PECL for the procedure.