0

I have a PHP web application and where users a upload files. I need to raise the limit to 2gb on my VPS that has 512mb of memory and 256mb of swap space. I have tried raise the limit by changing upload_max_filesize and post_max_size. It works when I raise the limit to 150mb, but not when I change it to 250mb. Any idea what is limiting it?

**UPDATE

My host is linode and I am running the 512mb VPS.

I am running Ubuntu 10.04 and am using apache2 with the default settings. I am changing the limit in my .htaccess file.

hakre
  • 193,403
  • 52
  • 435
  • 836
Conceited Code
  • 4,517
  • 3
  • 29
  • 32
  • What webserver are you using, and how is your webserver configured in that regard? – Jan Hančič Dec 24 '10 at 16:02
  • Does your uploading system need to store each uploaded file to memory before writing to disk? If so, you should redesign it to use a temporary file instead. Otherwise the maximum file size would be limited by available free memory. – thkala Dec 24 '10 at 16:26
  • I does not store it in memory, it stores it in a temporary directory. – Conceited Code Dec 24 '10 at 16:30

2 Answers2

1

Probably your host is limiting you. 512MB is very small amount of RAM for a server, so they restricted it to prevent crash or something.

Dejan Marjanović
  • 19,244
  • 7
  • 52
  • 66
0

Please note: 1. Your VPS may have limitation about disk space that it can use and that may cause the error 2. That post_max_size must be a little bigger than upload_max_filesize because of the encoding and POST's additional data. For example if you have:

upload_max_filesize = 100M

post_max_size = 100M

and your file is 99.99MB it may fail because of that.

Give post_max_size 5% more room to be on the sure side.

Ognyan
  • 13,452
  • 5
  • 64
  • 82