Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4546746
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:59:48+00:00 2026-05-21T15:59:48+00:00

Bottom-line : Do I need to be concerned about setting post_max_filesize >> memory_limit ?

  • 0

Bottom-line:
Do I need to be concerned about setting post_max_filesize >> memory_limit?

Details:
This answer suggests that uploaded files do not need to fit within php’s memory_limit. The php docs suggest that the entire post should fit within php’s memory limit.

I find the docs surprising and I’m hoping someone can elaborate. For example take the following php configs:

; config A
memory_limit = 50M
upload_max_filesize = 100M
post_max_filesize = 1000M
max_file_uploads = 10    

and

; config B
memory_limit = 50M
upload_max_filesize = 10M
post_max_filesize = 1000M
max_file_uploads = 100    

With these configurations I’d expect to be able to:

  • upload 10x100mb files to server A,
  • and 100x10mb files to server B.

I would also expect that:

  • Working with any one of the 10 files uploaded to server A is a problem (100Ms of file in a 50M bag…).
  • Working with any 1 of the 100 files uploaded to server B is okay (10 < 50).

While experimenting with less round but equivalently related numbers, I’ve found these expectations hold true.

This experience would lead me to say that “generally the memory_limit should be larger than the upload_max_filesize“; instead, the php docs say:

generally speaking, memory_limit should be larger than post_max_size.

Why and what happens if it isn’t?

When my php code is executed I see no evidence that all of the posted files are in memory. It seems to me that all I’ve got is a $_FILES array of paths to files found exclusively on disk. Is php holding the whole post in memory at some point prior to my ability to introspect the environment? Do I need to be concerned about setting post_max_filesize >> memory_limit?

Aside:
Violating the manual’s rule does not result in a grossly broken server (w/ php5.3 apache2.2 debian 6).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:59:49+00:00Added an answer on May 21, 2026 at 3:59 pm

    PHP will accept uploaded files that are individually smaller than upload_max_filesize and together take less than post_max_size bytes. The PHP documentation is wrong with regard to memory_limit which does not need to hold the file contents posted.

    The following configuration works with both Apache2 module and CGI, and accepts files smaller than 1G.

     upload_max_filesize = 1G
     post_max_size = 1G
     memory_limit = 32M
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a way to keep the scroll on bottom for a multi line
Fixed: See notes at bottom I am implementing a generic class that supports two
Notice in the bottom right hand corner of this page it has the SVN
Bottom up or top down? First I used top down but I felt to
Several extensions offer a bottom window for viewing their content. Firebug and ScribeFire are
(Scroll down to bottom of post to find solution.) Got a asp.net page which
(resolved: see bottom) I have the following code snippet: Protected Sub SqlDataSource1_Inserted(ByVal sender As
Reading the bottom of the documentation, specifically: You can still retrieve properties of deleted
Per the example array at the very bottom, i want to be able to
Stack Overflow has a subversion version number at the bottom: svn revision: 679 I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.