Re: [PHP] throttle output streamed from a file?

2006-05-10 Thread tedd
At 10:56 PM -0500 5/9/06, D. Dante Lorenso wrote: to a client who may be very slow. Aren't they all. :-) tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] throttle output streamed from a file?

2006-05-09 Thread D. Dante Lorenso
All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents are completely output

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread Jochem Maas
D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: it's not that relevant, but, I don't thinking streaming is the correct term. your merely dumping a files' content to std output. readfile($file_name); the trick you need to employ involves opening the file and

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread Eric Butera
On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread Chris
D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: readfile($file_name); However, this function has the problem that it reads the whole file into memory and then tries to write it to output. Sometimes, you can hit the memory limit in PHP before the file contents

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread D. Dante Lorenso
Jochem Maas wrote: D. Dante Lorenso wrote: All, I have a file which I want to stream from PHP: it's not that relevant, but, I don't thinking streaming is the correct term. your merely dumping a files' content to std output. readfile($file_name); the trick you need to employ

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread D. Dante Lorenso
Eric Butera wrote: On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote: To do this, I would think I need a function in PHP which will output a buffered stream with blocking enabled. Can anybody point me in the right direction? I'm probably way off base on what you're trying to do, but maybe

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread D. Dante Lorenso
Chris wrote: readfile works by reading in the whole file at once - if you don't want it to do that, you can't use readfile. You don't need anything complicated, or am I misunderstanding the question which is more likely.. $size = 1048576; // 1Meg. $fp = fopen($big_file1, 'rb');

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread Richard Lynch
On Tue, May 9, 2006 11:11 pm, D. Dante Lorenso wrote: Will 'echo' block until the client has consumed the whole $size amount of data? If not, how fast will your while loop execute? If file_size($big_file1) exceeds 1 TB, does your server end up sucking up all available memory? Or does PHP

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread D. Dante Lorenso
Richard Lynch wrote: On Tue, May 9, 2006 11:11 pm, D. Dante Lorenso wrote: will 'echo' block until the client has consumed the whole $size amount of data? If not, how fast will your while loop execute? If file_size($big_file1) exceeds 1 TB, does your server end up sucking up all available

Re: [PHP] throttle output streamed from a file?

2006-05-09 Thread Richard Lynch
On Wed, May 10, 2006 12:15 am, D. Dante Lorenso wrote: Ok, so, from the looks of it, the server writer seems to block on print when 2MB have filled the output buffer. 2MB is a good number, so I guess I don't need to do anything and everything magically works the way I would expect. But