MAMP v4.4.1无法修改php.ini以适配WordPress模板配置求助
Hey there, let's walk through how to successfully tweak your php.ini settings for WordPress on MAMP—this is a super common gotcha because MAMP hides its active php.ini file in a non-obvious spot, so you might’ve been editing the wrong one this whole time. Here’s your step-by-step fix:
1. Find the actual php.ini file MAMP is using
First, we need to confirm which php.ini your server is actively loading (editing any other file won’t do a thing):
- Open your phpinfo page at
http://localhost:8888/MAMP/index.php?language=English&page=phpinfo - Hit Cmd+F to search for Loaded Configuration File
- Copy the full file path shown here (it’ll look something like
/Applications/MAMP/bin/php/php7.1.12/conf/php.ini—the version number depends on your MAMP setup)
2. Edit the php.ini file with your required parameters
Now let’s open and modify the correct file using Terminal:
Launch Terminal (you’ll find it in Applications > Utilities)
Run this command, replacing
[your-copied-path]with the path you grabbed from phpinfo:nano [your-copied-path]If you hit a permission error, prepend
sudoto run it as an admin (you’ll need to enter your Mac user password when prompted):sudo nano [your-copied-path]Locate each of these parameters and update their values—if a parameter doesn’t exist, add it to the
[PHP]section of the file:memory_limit = 96Mmax_input_vars = 3000max_execution_time = 120post_max_size = 32Mupload_max_filesize = 32M
Save your changes and exit:
- In nano, press
Ctrl+O, then hit Enter to confirm the filename - Press
Ctrl+Xto close the editor
- In nano, press
3. Restart MAMP servers
Your changes won’t take effect until you restart MAMP:
- Open the MAMP app
- Click Stop Servers (wait for them to fully shut down)
- Click Start Servers again
4. Verify your changes worked
Head back to the phpinfo page and search for each modified parameter. You should see your new values (96M, 3000, 120, 32M) listed—this means the settings are active and ready for WordPress.
Quick Heads-Up to Avoid Frustration
Don’t waste time editing the php.ini file in /Applications/MAMP/conf/php/[php-version]/—that’s just a template file, not the one MAMP actually uses. Always trust the Loaded Configuration File path from phpinfo to make sure you’re editing the right file.
内容的提问来源于stack exchange,提问作者NanoVector

