I'm trying to allow users to upload large files (64MB) and am planning to change:
upload_max_filesize to 64MB
However, should I also change
memory_limit to 64MB or larger?
Is memory_limit connected to max_filesize?
I'm trying to allow users to upload large files (64MB) and am planning to change:
upload_max_filesize to 64MB
However, should I also change
memory_limit to 64MB or larger?
Is memory_limit connected to max_filesize?
Yes; memory_limit needs to be bigger than upload_max_filesize.
You'll also need to increase post_max_size ... as files are uploaded via a POST request.
I typically use upload_max_filesize<post_max_size<memory_limit as a rule of thumb, when configuring PHP.
post_max_size must be bigger than upload_max_filesize. If a form contains more file uploads then the post_max_size must be greater than the sum of them.
The memory_limit does not have any significant role in file uploads, as uploaded files are stored in the /tmp (Linux) directory, not in memory. If you want to submit large amount of data with form fields (not file uploads) then you need a big memory_limit otherwise not.
No, it's not necessary.
PHP has different POST readers and handlers depending on the content type of the request. In case of "multipart/form-data" (what is used for sending files), rfc1867_post_handler acts as a mixed reader/handler. It populates both $_POST and $_FILES. What goes into $_POST counts towards the memory limit, what goes into $_FILES also counts.
However, $_FILES has just meta-data about the files, not the files themselves. Those are just written into the disk and hence don't count towards the memory limit.