ZF-5703: Unnessesary Fatal Error: when post_max_size exceeds memory_limit setting

Issue Type: Improvement Created: 2009-02-05T18:41:05.000+0000 Last Updated: 2009-02-06T09:54:12.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: JR (jr) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

Related issues: Attachments:


I'm trying to use my own upload Zend_Form class with a file element and (setMaxFileSize) to auto create the hidden MAX_FILE_SIZE field. Using this class in my app gives a Fatal Error: Your 'post_max_size' config settings exceeds the 'memory_limit' setting. You should fix this.

Well, for many years I'm handling file uploads with php and never ever used more than a 128MB max_mem_size, even with 1Gb wire speed uploads I'm using 64MB max. The php settings affected to successfully upload files are in my believe:

  • upload_max_filesize
  • post_max_size
  • max_input_time

When the HTTP POST is successfully received and the php script starts doing funny things like copy, rename, etc the max_execution_time comes in. IF there are scenario's the memory_limit should be set at at least the post_max_size, could you please make this a Notice, instead of a Fatal error. Currently I've to set insane memory_limit values to accept 1GB form uploads or create the hidden field manually.


Posted by Thomas Weidner (thomas) on 2009-02-05T23:45:21.000+0000

When your memory settings are lower than your post filesize settings than you are not able to receive files which exceed the memory limit, as the posted data can not be received.

You can read this within PHP's manual within the php.ini directives: {quote} Generally speaking, memory_limit should be larger than post_max_size. {quote}

And when you switch off the memory limit (-1) then you will also not get an error triggered.

Posted by Thomas Weidner (thomas) on 2009-02-06T09:54:12.000+0000

Changed with r13999

Have you found an issue?

See the Overview section for more details.


© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.