0

Please do not close this as a duplicate. I know there are many similar questions posted here, but I have tried all of those answers with no change in the problem. I've looked into this for more than a week. All the answers I have found talk about the settings below, which I have already set properly.

My MAMP server's php.ini includes the following:

    file_uploads         On
    upload_max_filesize  16700000
    post_max_size        16777216
    memory_limit         768M
    max_input_time       360
    max_execution_time   360

My .htaccess file repeats these:

    php_value file_uploads         On
    php_value upload_max_filesize  16700000
    php_value post_max_size        16777216
    php_value memory_limit         768M
    php_value max_input_time       360
    php_value max_execution_time   360

and also has:

LimitRequestBody 16777216 
<IfModule mod_security2.c>
    SecRequestBodyLimit        16777216
    SecRequestBodyNoFilesLimit 16777216
</IfModule>

My httd.conf file includes the same settings.

When I examine at runtime with ini_get(), I see the php ini values given above, except that max_execution_time is always 0 (unlimited), regardless of these settings.

Using FormData in a XMLHttpRequest, if I upload a file up to about 1meg in size, the Content-length header looks correct and everything works fine. If I upload a file even slightly larger, I see all the same values, the Content-length header looks correct (and way less than post_max_size), but $_POST and $_FILES are empty, and the client sees HTTP status 413 Request Entity Too Large. Both the php and apache logs files show no errors.

UPDATE:

On further investigation I find Requested content-length of 1829686 is larger than the configured limit of 1024000 in apache_ssl_request.log. So where is this limit of 1024000 coming from? What limit is this? find /Applications/MAMP -type f -exec grep -l 1024000 '{}' \; only finds this error message, no config file entries with this value.

Bennett Barouch
  • 125
  • 1
  • 3
  • 10
  • Check httpd logs/config – Marcin Orlowski Mar 23 '20 at 12:27
  • No error messages logged. Config file as described in original post. – Bennett Barouch Mar 23 '20 at 12:29
  • **httpd** config. Not PHP – Marcin Orlowski Mar 23 '20 at 12:31
  • I have ```LimitRequestBody 16777216``` there and in my .htaccess file. What other settings do you have in mind? – Bennett Barouch Mar 23 '20 at 14:13
  • How do I get this not to be marked as a duplicate since the answers given to the seeming dupes have been accounted for here and have not resolved this problem? – Bennett Barouch Mar 23 '20 at 14:18
  • people with sufficient [privileges](https://stackoverflow.com/help/privileges) can vote to re-open your question if they deem it appropriate. – ADyson Mar 23 '20 at 14:33
  • Thank you for that info. I can only hope! – Bennett Barouch Mar 23 '20 at 15:01
  • `does not work` do not provide any additional information, if you ask me. – Marcin Orlowski Mar 23 '20 at 15:08
  • `Both the php and apache logs files show no errors` what about enforcing logging? both apache and php have such features – Marcin Orlowski Mar 23 '20 at 15:09
  • 1
    On further investigation I find ```Requested content-length of 1829 686 is larger than the configured limit of 1024000``` in ```apache_ssl_request.log```. So where is this limit of 1024000 coming from? What limit is this? ```find /Applications/MAMP -type f -exec grep -l 1024000 '{}' \;``` only finds this error message, no config file entries with this value. – Bennett Barouch Mar 23 '20 at 15:23
  • Solved. Super-embarrassing, stupid error. My .htaccess includes a long list of known-evil IP addresses, making it a bit long. In all the times I checked my file upload settings near the top of this file, I never noticed that I had a very small setting for one of the factors already sitting at the end of .htaccess, overwriting the correct value I had at the top. Why am I admitting this? To offer the following general advice: If you are sure you are making a correct setting and it seems to be overwritten, look lower down in the same file(s) in which you have made the correct setting. – Bennett Barouch Mar 31 '20 at 22:08

0 Answers0