问题
I'm using readfile() in a php download script.
When I try to download a 9gb sized file, I get the following error:
function.readfile</a>]: failed to open stream: Value too large for defined data type in path of my file
Is it possible to fix it or do I have to move those files to the public_html directory and link them directly?
回答1:
you can hack a way though. If you are on a unix environ, you can do
passthru('cat $filename');
as long as you don't need to write
回答2:
You most likely need to re-compile php with CFLAGS="-D_FILE_OFFSET_BITS=64"
so that PHP is able to handle large files. There's comment about that on the fopen documentation page.
Some additional reading:
- http://en.wikipedia.org/wiki/Large_file_support
- Althought you might not be using SUSE, still some interesting information: http://www.suse.de/~aj/linux_lfs.html
来源:https://stackoverflow.com/questions/6463586/value-too-large-for-defined-data-type