How to update php.ini for MAMP PRO

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:

  1. Identifying where the Configuration File (php.ini) was being loaded from – usually by running a PHP script which contained the phpinfo() function.
  2. Opening that file in my favorite text editor, editing as required, and saving changes.
  3. 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:

/Applications/MAMP\ PRO/MAMP\ PRO.app/Contents/Resources/php5.6.10.ini

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!