ID:               19485
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Output Control
 Operating System: Linux
 PHP Version:      4.2.3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Since the file is local and your OS supports mmap, PHP will try mapping
the file to memory before sending it out. Which, is what is responsible
for the delay, if the file is very big or you have little memory this
can take a while, since it may need to use swap to load the file. After
the file has been loaded, PHP begin sending the file to the browser.
Apache by default does not use mmap, unless you use mmap_static module,
so instead it opens the file and begins  to read it in chunks and
immidiately send the read chunks to the browser.

In majority of cases using mmap will be faster then reading data in
chunks.


Previous Comments:
------------------------------------------------------------------------

[2002-09-19 11:02:38] [EMAIL PROTECTED]

Maybe I should add that if I try to listen to a mp3 file directly from
a URL to my server without using a script like in my example, winamp
will immediately start buffering for about 0,2 sec and then start
playing, almost like it was from a local harddive so it is not my
server that is that slow (p166, SCSI disks). The mp3 file I'm testing
with is 6,6Mb, I don't want to think about how my server will suffer
when trying to load a 100Mb mp3 :(

------------------------------------------------------------------------

[2002-09-18 19:32:59] [EMAIL PROTECTED]

I have set output_buffering to Off and tried something as simple as
this:
playmp3.php
<?
readfile("mymp3.mp3");
?>
And the entire output is buffered somewhere. I tried to open the url to
the playmp3.php file in winamp and my server hdd LED lights up for
about 8 seconds, after that winamp shows it is buffring for about 0.2
sec (LAN connection to the server) and then starts playing. Nothing is
outputed from the server while the hdd LED is on and my slow server is
terrible busy :( Sometimes the buffering takes more then 10 sec and
winamp will time out. I'm using Apache 2.0.40 also.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19485&edit=1

Reply via email to