Hi Gary,

I found exactly the same code and tried it... it doesn't work in some cases... see other answers to my question by Joshua - it seems to be really problem with the Range headers...
Currently my situation is quite bas as our system runs with double autentization and it does server files directly from filesystem and no processed by PHP...

The memory allocation is not in any way connected to the PHP memory limit - it's cache of apache itself allocated for output from PHP causing my problems...

Thank you,
--
Kamil



Gary W. Smith wrote:

The following might help.  BTW, what is the memory limit in your php.ini file?  You might want to ensure that is a manageable number and then implement the code sample.

 

http://us3.php.net/manual/en/function.fread.php

 

 

For download the big files (more than 8MB), you must used ob_flush() because the function flush empty the Apache memory and not PHP memory.
And the max size of PHP memory is 8MB, but ob_flush is able to empty the PHP memory.

header('Content-Type: application/force-download');
header ("Content-Length: " . filesize($file));
header ("Content-Disposition: attachment; filename=$theFileName");

   $fd = fopen($file, "r");
   while(!feof($fd))
  {
       echo fread($fd, 4096);
       ob_flush();
      
   }

 

 


From: Kamil Srot [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 02, 2005 6:01 PM
To: users@httpd.apache.org
Subject: Re: [EMAIL PROTECTED] Memory consumption

 

Hi Gary,

Gary W. Smith wrote:

How are you reading the file in order to output it?  Some of the PHP
commands do indeed read the entire file before processing.  This would
cause the entire file to sit in ram.  I believe there are some binary
functions that only read segments at a time.  I think that is where you
problem lies.
  

I don't thing it's the case... I tried everything I was aware of - general fread, fpassthru etc.. all gives the same results...

 
Can you post (or send me) the relevant code segments that you use to
read the file and flush it to the client?
  

Currently its general fread/echo with no flush - as the flush seems even to make the situation worser...

I can provide packet for reproduction if you are going to investigate...

Thank you,
--
Kamil




Reply via email to