MAMP Pro v4.4多主机配置及PHP版本切换问题求助
Hey there! Let's walk through the common gotchas that might be tripping you up when assigning a custom PHP version to a new host in MAMP Pro 4.4 on High Sierra. I’ve helped folks troubleshoot this exact scenario before, so let’s break it down step by step:
1. Double-Check PHP Version Availability Globally
First, make sure the PHP version you want to use is actually enabled in MAMP Pro’s global settings—this is a super easy step to miss:
- Open MAMP Pro, click the PHP tab in the top navigation bar.
- Look for your target version in the list; if it’s grayed out, tick the checkbox to enable it. MAMP Pro only lets you assign versions that are active system-wide.
- Don’t forget to hit Save after enabling the version—changes won’t apply until you do this.
2. Verify Host-Specific PHP Settings
When setting up your new host, it’s easy to overlook the host-specific PHP dropdown. Let’s confirm you’re configuring it right:
- Select your new host from the left sidebar to open its settings.
- Navigate to the PHP tab for this individual host.
- Under "PHP Version," make sure you’re picking your desired custom version, not the "Default" option (which uses the global default PHP).
- Save the host settings, then fully stop and restart MAMP Pro’s servers (use the Stop Servers and Start Servers buttons in the toolbar—restarting is non-negotiable here).
3. Fix Document Root Permissions (High Sierra Quirk)
High Sierra has stricter file permissions, and this can interfere with PHP execution for specific hosts:
- Open Finder, go to the
htdocssubfolder for your new host. - Right-click the folder → Get Info.
- Under Sharing & Permissions, ensure your user account has Read & Write access. Click the gear icon and select "Apply to enclosed items" to propagate permissions to all files inside.
- If permissions are still wonky, fix them via Terminal with these commands (replace
/path/to/your/htdocs/subfolderandyour_usernamewith your actual path and Mac username):
(Runsudo chmod -R 755 /path/to/your/htdocs/subfolder sudo chown -R your_username:staff /path/to/your/htdocs/subfolderwhoamiin Terminal if you need to confirm your username.)
4. Test the PHP Version Directly
After making changes, verify the correct version is active for your host:
- Create a
phpinfo.phpfile in the host’s document root with this code:<?php phpinfo(); ?> - Access this file via your browser (both locally and remotely, since you use DDNS). Look for the "PHP Version" line at the top—it should match your assigned version.
- If it still shows the default version, clear your browser cache or test in incognito mode to rule out caching issues.
5. MAMP Pro 4.4-Specific Bug Workaround
Some users have reported that in MAMP Pro 4.4, the PHP version dropdown doesn’t save correctly unless you toggle the server type first:
- For your new host, go to the General tab.
- Toggle the server (e.g., switch from Apache to Nginx, then switch back to Apache).
- Return to the PHP tab, reselect your desired version, save, and restart servers. This forces MAMP Pro to refresh the host’s configuration files.
6. Manually Check Configuration Files (Advanced)
If all else fails, verify the host’s config file points to the correct PHP version:
- Apache: Host configs live in
/Library/Application Support/appsolute/MAMP PRO/conf/apache/hosts/your-host-name.conf. Open it in a text editor and look for lines likeAddHandler application/x-httpd-php74 .php—the version number should match your selection. - Nginx: Configs are in
/Library/Application Support/appsolute/MAMP PRO/conf/nginx/hosts/your-host-name.conf. Look forfastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/PHP-7.4.3.sock(again, check the version number). - If the config has the wrong version, recheck your host settings, save, and restart servers—MAMP Pro should regenerate the config correctly.
Chances are one of these small, easy-to-miss steps will fix your issue. Let me know if you hit any snags!
内容的提问来源于stack exchange,提问作者Duane Mitchell

