php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65389 Correlation between memory_limit and post_max_size
Submitted: 2013-08-05 09:21 UTC Modified: 2015-08-05 14:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: marc at ermshaus dot org Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-08-05 09:21 UTC] marc at ermshaus dot org
Description:
------------
This is more or less a duplicate of this bug report:

- https://bugs.php.net/bug.php?id=52229

I am opening a new one because I think my comment there went by unnoticed.

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

“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.”

To me, the phrasing is misleading as it implies that file uploads (<input
type="file">, multipart/form-data, $_FILES array) have to fit into
memory_limit. That is probably not the case. It is my understanding that the
second sentence from the quote only holds true for large
application/x-www-form-urlencoded POST requests (without file uploads) while
the first sentence is more or less incorrect/superfluous.

For example, uploading two 4M files with settings memory_limit 2M,
post_max_size 10M, upload_max_filesize 5M should work. 4M < upload_max_filesize
and 4M+4M < post_max_size. memory_limit should not affect this at all.

Other mentions and discussion of this issue:

- http://stackoverflow.com/questions/3651141/in-php-settings-should-memory-limit-upload-max-filesize
- http://stackoverflow.com/questions/5106871/relationship-between-phps-memory-limit-upload-max-filesize-and-post-max-filesi



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-18 07:27 UTC] yohgaki@php.net
-Status: Open +Status: Analyzed
 [2013-08-18 07:27 UTC] yohgaki@php.net
This report is valid, since newer handler does not consume memory. Current 
documentation is valid for old PHPs which are no longer supported.
 [2015-08-05 14:49 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2015-08-05 14:49 UTC] cmb@php.net
> This report is valid, since newer handler does not consume
> memory.

The "newer handler" basically seems to be in place since 2001[1]
(i.e. long before PHP 5.0.0), so the documentation doesn't have to
mention it in the changelog.

[1] <https://github.com/php/php-src/commit/44b68122c2ba0cf07cd837af160b3bd01527d081>
 [2015-08-05 14:56 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337294
Log: removed out-dated info that file uploads are restricted by memory_limit (fixes
#65389)
 [2015-08-05 14:56 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2015-08-05 14:56 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 18:01:31 2024 UTC