PHP: can’t increase maximum upload limit

apache-2.2PHPupload

I'm using Apache + PHP 5.3.3-7 on Debian Squeeze, installed from the repositories. The PHP distribution in Debian Squeeze includes Suhosin patch. I have problems uploading files bigger than cca 4 MB, some invisible limit prevents the PHP from accepting the upload.

In php.ini I have:

  1. set upload_max_filesize = 50M
  2. set post_max_size = 50M
  3. set memory_limit = 256M
  4. set max_execution_time = 120
  5. set max_input_time = 120

In suhosin.ini:

  1. suhosin.memory_limit = 256M
  2. suhosin.post.max_value_length = 50000000
  3. suhosin.request.max_value_length = 50000000
  4. suhosin.post.max_vars = 200000
  5. suhosin.request.max_vars = 200000

I actually doubt the last two ones are important at all, but I was adviced to increase them as well.

I know for sure that PHP actually loads the config values correctly, since phpinfo() matches my expectations. I'm expecting to be able to upload a file up to 50MB, but uploading of 4MB already fails. There are no logged errors in normal PHP per-site logs. And I'm sure there is enough space is available to save the uploaded file.

It seems like there is some other invisible limit preventing me from uploading the files. What could this be? Perhaps the Apache itself? Never heard of this limit though.

I spent nearly one week on this and I'm desperate, as well as my customer. Any hints are welcome.

Best Answer

First, it seems that this is wrong. Assuming a typo, but will point out anyway:

set upload_max_filesize = 5OM

That should be a 0 right?

set upload_max_filesize = 50M

It also seems like memory_limit is empty in your post as well?

Anyway, past those settings you should also adjust max_execution_time and max_input_time so the upload itself does not timeout. Depends on speed and connection, but getting a proper grip on all of the above should allow you to upload 50MB files without too much issue.

Related Topic