Value too large for defined data type

不羁的心 提交于 2020-01-14 05:54:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!