Re: big files download with php - configuration problem

From: Date: Wed, 23 Jul 2008 21:45:27 +0000
Subject: Re: big files download with php - configuration problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-277213@lists.php.net to get a copy of this message
On 7/23/08, Giulio Mastrosanti <giulio@cantoberon.it> wrote: > Hi all, > > I have a set of php scripts that handle the browsing and download of file > from the server. > > it has worked fine for a long time on a server linux, now I have got to > migrate those scripts also on a windows server, and something very strange > is happening: > > the download process hangs when downloading big ( 50 MB and up ) files from > the server, and the files are only partially downloaded. > the log on the server shows a Timer_connectionidle error message. > > I'm quite sure it is a configuration ( php or IIS ) issue, but I have no > idea about what could be the problem. > > it is not an execution time problem since I have set the max_execution_time > on the php.in to a very large value. > it seems that the php script simply stops communicating with the server, and > after a while the server kills it. > > the original script used a readfile($filename) function, I have also tryed > to replace it with fopen($filename, 'rb') and a while cicle with > fread($filename, $chunksize), but with no success. I would recommend looking into a webserver that supports offloading the file download to the webserver via fastcgi: - nginx (preferred) using X-Accel-Redirect header - lighttpd using X-Lighttpd-Sendfile header - apache has a module mod_sendfile or something, but I don't recommend apache for anything anymore not sure if other webservers have it or not. But basically it allows you to use PHP/application level logic to validate if the user has access, and then tells the webserver "okay, now send the file" and releases PHP/application level from having to spoonfeed the file using things like readfile() and keeping the PHP thread/whatever open

« previous php.general (#277213) next »