9

MAMP Pro has separate php.ini files for each PHP version but when I edit the file and restart the server nothing has actually changed.

Specifically I'm trying to change PHP upload values:

post_max_size = 256M
upload_max_filesize = 256M
max_execution_time = 300
max_input_time = 300
memory_limit = 512M

But I have tried changing other php.ini values as a test but those changes aren't respected by PHP either.

Andrew
  • 3,335
  • 5
  • 36
  • 45

2 Answers2

29

It turns out that browsing to the files and editing them directly is not the best way, you should use MAMP's built-in Template Editor.

You can turn this on by going to:

File > Edit Template > PHP > The PHP version you're running

If you can't see the File menu at all, it could be that you have the Hide Dock Icon preference set. In this case you'll need to uncheck that preference, restart MAMP, then use the template editor to tweak my php.ini file, save, restart Apache, done!

Andrew
  • 3,335
  • 5
  • 36
  • 45
  • @Dagon You'd think so, but it didn't work for me, it seems to be confirmed in the [official docs](https://documentation.mamp.info/en/documentation/mamp-pro/#7.6-Changes-to-my-php.ini-file-andor-my-httpd.conf-file-are-not-showing-up-when-I-restart-MAMP-PRO): "Changes to my php.ini file and/or my httpd.conf file are not showing up when I restart MAMP PRO... You must edit the httpd.conf, php.ini and my.cnf files through the Template Editor provided by MAMP PRO." – Andrew Jun 15 '16 at 09:51
  • Do you a way to change MAMP's native editor it uses for editing .php files? I'd like to change it so that when I edit the file like you described, it'll use an editor app of my choice. – thaikolja Sep 06 '17 at 18:02
0

I like to sidestep these sorts of issues for local development and modify ini settings in my code. PHP provides ini_get and ini_set and if you call them at the beginning of your execution, you can set your own ini file in code.

Zach Rattner
  • 20,745
  • 9
  • 59
  • 82
  • Indeed, in your own apps that's a good way to go, it means your settings will be right regardless of server configs. However for third party apps and system defaults, editing the shared ini file itself can sometimes be more useful. – Andrew Jun 15 '16 at 09:48