First, I am running (currently) php 4.0.6 under Redhat 7.2 with kernel

I know you can do the following:


header("Content-type: application/force-download");
header("Content-disposition: attachment; filename=blah.txt");


to force the user to download a file. 

However, this wouldn't work if blah.txt is larger than 2G on my machine
with php 4.0.6 for Redhat 7.2, because all the file I/O operations are
done in 32 bits functions. 

So here are two solutions i though about:

1) instead of readfile("blah.txt"), do a passthru("cat blah.txt"). Since
the basic idea of forcing a download is to pipe the file content to the
standard output (which is the browser in this case), i don't understand
why passthru("cat blah.txt") wouldn't do the trick. In fact, I can only
download about 88Mbs of the whole 4G file I planned to download. 

2) recompile the php package with -D_FILE_OFFSET_BITS=64 enabled. However,
with the ./configure; make; make install, i can't seem to figure out where
to stick the option in. (prefer doing it in one of the configure arguments
if possible)

Forgive me if I posted this to the wrong mailing list, I had been losing
hairs over these puzzled questions.


Wei Weng
Network Software Engineer
KenCast Inc.

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to