-   Linux - Software (
-   -   PHP memory_limit vs. upload_max_filesize (

fhsm 02-22-2011 04:30 PM

PHP memory_limit vs. upload_max_filesize
I'm having a very frustrating time getting large uploads working with Debian 6, Apache 2.2, and php 5.3.

As I increase the upload_max_filesize & post_max_size configs at some point all uploads (regardless of size) start to fail silently.

I've got my timeouts set to 600 seconds; I'm not running into timeout problems. I'm setting post_max_size to upload_max + 10mb, which should be more than enough for an otherwise empty upload test form.

It works as expected with 64mb uploads but with 128mb uploads it fails silently.

Should it be theoretically possible for php to accept an upload that is larger than its memory_limit (ie a php process memory_limit of 128mb and upload_max_filesize of 129mb) or does it all need to fit in memory? If it is theoretically possible does anyone else have any insight into making it actually happen?


Tinkster 02-22-2011 07:58 PM

What's the free space of the partition in which your apache stores tmp-files?


fhsm 02-23-2011 09:31 PM

Current free space on the partition is 492 Gb. An interesting thought but I don't think it's the problem.

To clarify when I increase the upload limit in php.ini *all* uploads, regardless of size, start to fail. When I lower the upload limit in php.ini I'm able to upload files that had previously failed. So for example with upload_max_filesize set to 20mb I can upload a 4mb test file but not a 40mb test file (obvious reasons) with upload_max_filesize set to 80mb I can't upload the 4 or the 40mb test file.

Tinkster 02-23-2011 10:02 PM

Interesting ... I never heard of this before; a quick google suggests
that the memory_size should be larger than the post_max size which
the drupal guys apparently set to be the same as upload_max_filesize.

fhsm 02-24-2011 05:49 AM

This stackoverflow answer references this php source file in claiming that uploaded files are not counted towards the scripts memory_limit.

That said the php docs are (equivocally) in keeping with the Drupal page you linked.

The behavior I'm getting is so hard to nail down that I'm starting to wonder if it's actually a bug...

Any other thoughts?

All times are GMT -5. The time now is 11:03 AM.