Question

I am using the Resumable.js library to upload files in 1 MB chunks and then piecing them back together using PHP on a 32-bit linux server (PHP 5.3.14, Apache 2.0)

This is working great, except for with files over 2GB.

When I upload a file that is larger than 2GB, it appears to work fine, but when you actually view the file properties the size is always 2147483648 bytes.

From my reading, I understand this to be a limitation of PHP's use of 32-bit integers.

I have read that setting the CFLAGS="-D_FILE_OFFSET_BITS=64" flag and recompiling PHP will allow PHP to open files larger than 2GB.

My question is, if I do this, will this fix my problem, or is the opening of the file not just the problem, but the appending of the file as well?

If this will fix my 2GB problem, is there still a (higher) theoretical max file size?

If I'm completely off base and this flag will not fix my problems, are there any other potential solutions besides switching to a 64-bit server?

Was it helpful?

Solution

You're stuck at the 2GB file size limit by Linux on 32-bit machines (see http://linuxmafia.com/faq/VALinux-kb/2gb-filesize-limit.html ).

You might want to consider keeping the total file split into chunks of some smaller size, or get a 64 bit machine. Typically files larger than a GB are avoided in many systems over chunk implementations anyway for performance purposes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top