On Tue, November 21, 2006 1:26 pm, Brad Fuller wrote: >> I think it will use 1M... >> >> > function readfile_chunked($filename,$retbytes=true) { >> > $chunksize = 1*(1024*1024); // how many bytes per chunk >> >> :-) > > Yes 1M is what I meant, although you can set it to whatever you want. > >> The multiple calls to ob_flush() within the body of the loop are >> probably not a Good Idea, as a general rule... > > I think you missed the point of the function. I think not. I think you'd want to call ob_flush() in a loop at the top until ob_get_level() returned 0, rather than rely on the number of ob_handlers stacked up being smaller than the number of Megabytes to be pumped out. That's assuming you would want to override any and all ob_start() in the first place, which seems a decidedly odd way to structure a web application to me. I would expect that your MP3 output URL would have already turned OFF output buffering in any php.ini type setting, and wouldn't have started any output buffering up in the first place, since you almost-for-sure knew from the very beginning of this request that you were outputting an MP3 file, which, by its very nature, you would not want to bufffer. >> flush() is also probably overkill, really, for any file big enough >> for >> this function to be desirable in the first place... > > Php.net says "flush() has no effect on the buffering scheme of your > webserver or the browser on the client side. Thus you need to call > both > ob_flush() and flush() to flush the output buffers. " flush() is largely irrelevant to the HTTP interaction. TCP/IP, HTTP, Apache, etc all add buffers and network lag that render flush() meaningless in this context. Later versions of PHP, I think, pushed the boundary of flush() up to/through the Apache layer of buffering. But they have zero effect on TCP/IP stack, much less any sort of other client-server buffering. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php