Re: Slow file download

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

 



If the files are LARGE, file_get_contents is a Bad Idea (tm).

You're trying to suck the whole thing into RAM, which it can't, which swaps and thrashes the bleep out of your RAM/swap space...

Use fopen and an fread loop instead, and you'll probably see much better performance.

Also, consider going old school and getting rid of the stream_context stuff.  It's "new" and "untested" :-)

You can use ini_set and the parameter or even fall back to fsockopen with a timeout.

Note that those time-outs are for any given packet to arrive (or the socket to open) not the whole enchilada to download.


-- 
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