Link to home
Start Free TrialLog in
Avatar of zixp
zixp

asked on

File sent by header stops sending halfway

I have a php system set up where people can log in and download files, that are stored outside of the WWW root.  PHP sends the file via the header (after authentication).  The problem is that the transfer stops about halfway.  I have watched it download about half of the file, and it remains around 180kb (does not steadily drop down to 0.00 as I have seen from some sites), but then just gives up.  Is this a limitation in my server or something?  I am running Windows 2000 Advanced Server with IIS 5.0, mysql, and PHP 4.3.8.  Thanks in advance.
Avatar of Skonen
Skonen

There are several things that could be responsible, but for starters check to make sure your script max execution time is set to a very high number or 0. By default it is 30, which means all scripts are terminated after 30 seconds.

To see your currrent time limit:
echo init_get("max_execution_time");

To set your time limit:
set_time_limit(3600); // An hour

To get rid of the time limit altogether:
set_time_limit(0);


As I said there are many things that could cause such a problem, but you may want to start from the simplest possibilities first.

Stuart Konen
If you ever for some reason have to worry about a script running forever (doubtful), then ignore_user_abort() should be called, passing the BOOL value of FALSE:

ignore_user_abort(FALSE);

However, don't use ignore_user_abort() if you won't be keeping a constant connection with the client.
ASKER CERTIFIED SOLUTION
Avatar of Logan
Logan
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zixp

ASKER

Thanks a lot, I used your code, and the file went through
Glad to help :)