Re: [PHP] Files passing through

2005-08-23 Thread Philip Hallstrom
Benchmark it both ways and see. I benched this with a 100 MiB text file (largest I could find at short notice). Buffer used for fread() calls was 2 KiB as above. Values are averaged over 100 runs (I would have liked to do more, but I don't have time). All values are to 4 significant figures

Re: [PHP] Files passing through

2005-08-23 Thread Jasper Bryant-Greene
Richard Lynch wrote: On Tue, August 23, 2005 12:48 am, Jasper Bryant-Greene wrote: Kim Steinhaug (php list) wrote: I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer;

Re: [PHP] Files passing through

2005-08-23 Thread Richard Lynch
On Tue, August 23, 2005 12:48 am, Jasper Bryant-Greene wrote: > Kim Steinhaug (php list) wrote: >> I'm using this method, works fine with 50mb+ files : >> >> if( $fd = fopen ($filepath, 'r')){ >> while(!feof($fd)) { >> $buffer = fread($fd, 2048); >> print $buffer; >>

Re: [PHP] Files passing through

2005-08-23 Thread Jasper Bryant-Greene
Kim Steinhaug (php list) wrote: I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } Is there a reason why you assign the

Re: [PHP] Files passing through

2005-08-23 Thread Kim Steinhaug \(php list\)
- Original Message - From: "Evert | Rooftop" <[EMAIL PROTECTED]> To: "PHP-Users" Sent: Monday, August 22, 2005 9:30 PM Subject: [PHP] Files passing through > Hi People, > > I want to use a PHP script to pass through a file to the browser [ right &g

Re: [PHP] Files passing through

2005-08-22 Thread Richard Lynch
On Mon, August 22, 2005 12:30 pm, Evert | Rooftop wrote: > I want to use a PHP script to pass through a file to the browser [ > right > after some processing ]. > What is the fastest way to do this? I know > echo(file_get_contents('myfile')); is not a good idea ;) Actually, it's a Fine Idea *IF* t

Re: [PHP] Files passing through

2005-08-22 Thread Jasper Bryant-Greene
Kevin Waterson wrote: This one time, at band camp, Philip Hallstrom <[EMAIL PROTECTED]> wrote: My guess would be because file_get_contents returns the contents as a string. So if 'myfile' is 100mb, you're going to have to allocate 100mb of memory to store that string while echo() spits it ba

Re: [PHP] Files passing through

2005-08-22 Thread Kevin Waterson
This one time, at band camp, Philip Hallstrom <[EMAIL PROTECTED]> wrote: > My guess would be because file_get_contents returns the contents as a > string. So if 'myfile' is 100mb, you're going to have to allocate 100mb > of memory to store that string while echo() spits it back out. > > But I'

Re: [PHP] Files passing through

2005-08-22 Thread Philip Hallstrom
What is the fastest way to do this? I know echo(file_get_contents('myfile')); is not a good idea ;) Why not? My guess would be because file_get_contents returns the contents as a string. So if 'myfile' is 100mb, you're going to have to allocate 100mb of memory to store that string while ech

Re: [PHP] Files passing through

2005-08-22 Thread Kevin Waterson
This one time, at band camp, Evert | Rooftop <[EMAIL PROTECTED]> wrote: > What is the fastest way to do this? I know > echo(file_get_contents('myfile')); is not a good idea ;) Why not? Kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb

[PHP] Files passing through

2005-08-22 Thread Evert | Rooftop
Hi People, I want to use a PHP script to pass through a file to the browser [ right after some processing ]. What is the fastest way to do this? I know echo(file_get_contents('myfile')); is not a good idea ;) Is fpassthrough the right choice? maybe virtual, so it won't go through php but apac