1

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.

2
  • If you've really set upload_max_filesize = 5OM, the letter O instead of the number 0 may cause problems.
    – ceejayoz
    Mar 8, 2013 at 21:20
  • Thanks but was really just a typo, it's not present in the config file, i double-checked it now. Mar 8, 2013 at 21:27

1 Answer 1

0

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.

6
  • Sorry for the typos, I edited the original post. The o->zero typeo is not present in the config file, double-checked it right now. Speaking of max_execution time and max_input_time, do they actually matter? My experience is that they are only meant to limit the time to parse the input (2 minutes for 50M should be more than enough) and to limit the execution of the script itself (excluding system calls, waiting for the input, etc, etc..). Waiting for slow upload from client doesn't count into the limit. Mar 8, 2013 at 21:30
  • Hmmm… Okay, your settings look correct. But are these from your php.ini file? Or from running phpinfo() in PHP? Are you sure you edited the correct file? And restarted Apache? And verified these settings in PHP via phpinfo()? Mar 8, 2013 at 21:34
  • Yes, phpinfo() reflects my changes. And yes, I restarted Apache, even tried restarting the virtual server. I have an idea though. Could it be caused by a defective or misconfigured APC? The app I'm running requires APC and I needed to compile it from source, because the old version in repositories didn't include some features the script needed. Mar 8, 2013 at 21:40
  • APC is a PITA. I would look into adjusting /etc/php5/conf.d/apc.ini via the config options outlined here: php.net/manual/en/apc.configuration.php Mar 8, 2013 at 21:43
  • I tried to make a simple upload form and disabled the APC. Now everything works just fine. So now I know at least where the problems came from and I will investigate the APC issue further. Thank you for your help. Mar 8, 2013 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .