PHP empty $_POST and $_FILES with large file upload [duplicate]

限于喜欢 提交于 2020-04-07 08:43:07

问题


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.

来源:https://stackoverflow.com/questions/60813533/php-empty-post-and-files-with-large-file-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!