1

I tried to raise the upload_max_filesize value in the php.ini (mamp 2.1.2 with the PHP version 5.4.10). The Server runs on port 80. I found several anwsers here but no one really applies.

When I use the phpinfo () function to get the "Loaded Configuration File" I get the path: /Applications/MAMP/bin/php/php5.4.10/conf/php.ini, but the shown configuration form the phpinfo () don't match with the configuration in my php.ini.

In my php.ini stands upload_max_filesize = 100M the phpinfo () tells me 2M.

After I edited the ini I restared the server and my machine.

So why can't I change the upload_max_filesize?

Edite: After setting the Port to 8888 the config file is loaded correctly. Maybe there is a conflict with the Apache-Server of the OS?!

crashbus
  • 1,678
  • 18
  • 37
  • I've tested it with PHP 5.4.4 on MAMP and it works without problems on the same path you stated. You might want to do `Stop Servers` then quit MAMP and check Activity Monitor if any php/mysql processes are still running. I had some issues in the past with MAMP running colliding versions that didn't really stop or hung after the MAMP application was shut down, causing these kind of erroneous problems. –  Mar 11 '13 at 17:20
  • Unfortunately this don't fix my problems. I restarted the hole computer and the values aren't changed. – crashbus Mar 12 '13 at 08:47
  • This sounds silly, but it happens to a lot of experienced users. MAMP cashes pages. It might be that `phpinfo()` file you run still shows a cached version of the page. Also is the MASTER value the same as your LOCAL value? (the two separate columns in the `phpinfo()`). In Safari you can empty with `ALT+CMD+E`. If this doesn't work; try to upgrade to the latest MAMP and otherwise try the MAMP forums. This is a pretty odd issue. –  Mar 12 '13 at 09:17
  • I disabled/cleared the cache in my browser and in MAMP - the result is the samen, in addition both columns are showing the same (2M). – crashbus Mar 12 '13 at 11:01

3 Answers3

9

This is because MAMP and MAMP PRO overwrites php.ini with a template file every time the services are started. Therefore, to make your desired php.ini changes, you need to change the template.

In my instance using MAMP PRO on OS X, that template was found within:

/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/

In this folder, you will find several php.ini versions for each version of PHP that is available to you. You will want to edit the .ini file for the PHP version you are running. In my case, that was php5.5.10.ini. After editing, restart your MAMP and your new settings should take effect.

Sators
  • 2,746
  • 1
  • 20
  • 26
1

Also you have to edit: post_max_size and memory_limit

post_max_size integer Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. , and then checking if $_GET['processed'] is set.

php ini core manual

tttony
  • 4,944
  • 4
  • 26
  • 41
-2

Try editing /Applications/MAMP/bin/php/php5.4.10/conf/php.ini and restart the server.

Or try to set it programmatically

ini_set('upload_max_filesize', '100M');
devBinnooh
  • 611
  • 3
  • 12
  • you can only do ini_set for uploads in .htaccess as php will reject the file before it hits the php script – Waygood Mar 11 '13 at 17:15
  • http://php.net/manual/en/function.ini-set.php "Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending" – devBinnooh Mar 11 '13 at 17:16
  • The file will be rejected __BEFORE__ the script executes, so it will never get set and used! http://stackoverflow.com/questions/3694114/php-file-size-limit – Waygood Mar 11 '13 at 17:19