Re: handling large files w/readfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

> i'm working on a app which output files with readfile() and some headers..
> i read a comment in the manual that says if your outputting a file php
> will
> use the same amount of memory as the size of the file. so, if the file is
> 100MB php will use 100MB of memory.. is this true?
>
> if it is, how can i work around this?

Do not use readfile() or file_get_contents() to read
the full file in one step. Read file in smaller chunks
to a buffer variable whith fread() and output that
immediately in the cycle. And again and again...
You can read terrabytes of data and utput them, the
amount of memory needed is based on your buffer size.

-- 
=============================================================
Heilig (Cece) Szabolcs - cece@xxxxxxx - http://www.phphost.hu
=============================================================

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux