When uploading a very large file in PHP, how much RAM is required on the server?

I am reading http://www.php.net/manual/en/ini.core.php#ini.post-max-size .

memory_limit should> post_max_size. Then, if the user uploads a 500 MB file, how much is the total amount of RAM used?

Does it use> 500 MB?

+6
source share
1 answer

No, memory_limit should not be more than post_max_size.

PHP has different POST readers and handlers, depending on the type of request content. In the case of "multipart / form-data" (which is used to send files) rfc1867_post_handler acts as a mixed reader / handler. It fills both $_POST and $_FILES . What is included in $_POST is taken into account in the memory limit, and what is included in $_FILES also taken into account.

However, $_FILES only has metadata about the files, not the files themselves. They are simply written to disk and therefore not counted in the memory limit.

+2
source

Source: https://habr.com/ru/post/887546/


All Articles