Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-19 Thread Ruben Rubio Rey
:( Its not working $bytes = @readfile($filename); if ($bytes === false){ //error-handling code } There is not any output ? Richard Lynch wrote: On Fri, October 14, 2005 6:29 am, Ruben Rubio Rey wrote: if(file_exists($filename)){ $modified_date=filemtime($filename);

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-16 Thread Ruben Rubio Rey
Richard Lynch wrote: On Fri, October 14, 2005 6:29 am, Ruben Rubio Rey wrote: if(file_exists($filename)){ $modified_date=filemtime($filename); if(time()<($modified_date+1 * 24 * 60 * 60)){ $handle = fopen($filename, "r"); $contents = fread($handle, f

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-15 Thread Chris Shiflett
Ruben Rubio Rey wrote: $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); echo $contents; Replace this with: readfile($filename); It's faster for both you and PHP. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http:

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-14 Thread Richard Lynch
On Fri, October 14, 2005 6:29 am, Ruben Rubio Rey wrote: >if(file_exists($filename)){ > $modified_date=filemtime($filename); > if(time()<($modified_date+1 * 24 * 60 * 60)){ > $handle = fopen($filename, "r"); > $contents = fread($handle, filesize($file

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-14 Thread Marcus Bointon
On 14 Oct 2005, at 12:29, Ruben Rubio Rey wrote: * For files less or equal 6 Kb, takes arround 0.02-0.03 miliseconds - its ok * For files arround 35 Kb takes arround 0.2-0.4 miliseconds - too much. Bearing in mind that average access time on a 7200rpm HD is around 8ms, those numbers sound

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-14 Thread Jochem Maas
Ruben Rubio Rey wrote: Hi, I m creating a cache system, and i have a problem: PHP takes a lot of time opening the file. (Im using 2.6.9-1.667smp and XFS) * For files less or equal 6 Kb, takes arround 0.02-0.03 miliseconds - its ok * For files arround 35 Kb takes arround 0.2-0.4 miliseconds

Re: [PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-14 Thread Richard Davey
Hi Ruben, Friday, October 14, 2005, 12:29:09 PM, you wrote: > What can I do to make faster opening files? > ** > Source code: >if(file_exists($filename)){ > $modified_date=filemtime($filename); > if(time()<($modifi

[PHP] OPTIMIZING - The fastest way to open and show a file

2005-10-14 Thread Ruben Rubio Rey
Hi, I m creating a cache system, and i have a problem: PHP takes a lot of time opening the file. (Im using 2.6.9-1.667smp and XFS) * For files less or equal 6 Kb, takes arround 0.02-0.03 miliseconds - its ok * For files arround 35 Kb takes arround 0.2-0.4 miliseconds - too much. What can I d