Changes to my php.ini file kept getting overwritten, until I found where the real file was being loaded from! Here’s how to update php.ini for MAMP PRO.
Usually, updating PHP configuration variables is as easy as one, two, three:
- Identifying where the Configuration File (php.ini) was being loaded from – usually by running a PHP script which contained the phpinfo() function.
- Opening that file in my favorite text editor, editing as required, and saving changes.
- Restarting PHP servers via MAMP PRO console.
I was recently setting up a new Mac Mini for my home work station, but for whatever reason, following those steps wasn’t working. Specifically, I was trying to change the upload_max_filesize PHP configuration variable in my MAMP PRO (3.3) installation on Mac OS X Yosemite (10.10.2).
I kept trying to change the Configuration File (php.ini) indicated via phpinfo() (/Applications/MAMP/bin/php/php5.6.10/conf/php.ini), but changes to this file were getting overwritten every time I restarted the servers. After a bit of poking around, I discovered that MAMP PRO was actually copying a template file for the PHP configuration on start-up, which would clobber the file I’d been changing.
Turns out here’s the path that’s actually used for the php.ini file:
[syntax type=”html|php|js|css”]/Applications/MAMP\ PRO/MAMP\ PRO.app/Contents/Resources/php5.6.10.ini[/syntax]
I used “php5.6.10.ini” as the file name because my MAMP PRO was loading up that version of PHP – there’s a long list of .ini files in the /Resources directory, though, so pick the one that corresponds to the version of PHP you’re running. Edit, save, and restart servers, and you should be all set!
This is really relevant to my issue, but your path:
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/
looks weird and does not not exist on my system. I’m referring to the ‘MAMP PRO/MAMP PRO.app’ bit. Your thoughts?
Hi Gustav – thanks for the question. First off, are you using macOS or Windows? This is a macOS file path.
If you’re on macOS and looking for the file via Finder, you might not be able to see it because most applications group all their sub-directories and files together in a “Package”. You can access these files by going to your “Applications” directory, opening the “MAMP PRO” folder, right-clicking on the “MAMP PRO” application icon, and selecting “Show Package Contents”. (see screenshot below)
From there it should be a straight shot to the file in question.
Let me know if that helps. If so, I’ll make an edit to the original post to make this clearer.
Thanks and happy coding!
Comments are closed.