My PHP web application requires files (about 2.5 to 3 GB in size) to be uploaded to the server. How will this impact on following directives ?
what are the required values in my case?
- post_max_size
- upload_max_filesize
- memory_limit
Your help will greatly be appreciated.
Accepted Answer
post_max_size
should be3G
upload_max_filesize
should be3G
memory_limit
depends!!! what you are going to do with the file. If you are going to manipulate the file or do other memory intensive jobs, then you will need to set a high limit. If you don't want to put a maximum limit, you can always set it to-1
. This value doesn't have to do much with the size of the file, but rather with the size of the physical memory your script needs to handle the job.
For the first two, it is the maximum file size you expect to be uploaded, suffixed with a short hand byte value. For KB
should be K
, MB
should be M
, GB
should be G
, ...
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki
Comments
Are you using 32bit or 64bit PHP?
i am running 32 bit system (Fedora14)
If your dealing with files that big, you should use FTP to transfer the file. The bigger the file, the more time it requires to send the file. Sometimes the connection can be reset causing the transfer to fail. Something to think about
About
memory_limit
- I've read that it has to be set to larger value, if large files need to be uploaded, though, when testing, I saw that files are instantly saved to temporary directory (rather than memory), somemory_limit
was not a problem.@colum first i need to transfer the file to the webserver. for that i am using ajax upload. secondly, i need to transfer the file to another linux server. i am using PHP-SSH2 for this. I am not facing any connection timeout problem
About
post_max_size
andupload_max_filesize
- I might be wrong, but they might be limited to 2GB on 32bit systems. This should be tested. If there is such limit, workaround would be disabling them completely. You might also be interested in configuringmax_input_time
, though I don't think that there should be problems because of it.@binaryLV You are correct on that. On 32bit systems, php/apache can not handle files over 2GB