Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2006, 05:44 PM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default serving a growing file

I init a download for a user via http before the file is finished growing. (if i wait till it's done growing it will take 2 minutes)

problem is that the below method only serves the file up to the point when i opened it. say 2-10 megs but the file ends up being 400 megs.

Code:
        header('Content-Type: application/x-zip');

    $fp = fopen("C:\\Apache\\htdocs\\{$new_file}", "rb");

    while(!feof($fp)){
        $buf = fread($fp, 2048);
        print $buf;
    }
Does anyone have a way to keep serving the file until it's complete..
when is it complete? no idea ....

 
Old April 9th, 2006, 12:50 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Sounds like you're hitting the memory limit in PHP. Look at the INI directive memory_limit, it's 8MB by default, to download a 400MB file, it'd need to be much larger. You may also need to tweak max_execution_time.

http://www.php.net/manual/en/ini.php#ini.list

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display .tif file, .pdf file and .jpg file phuong171 ASP.NET 1.0 and 1.1 Basics 1 March 13th, 2007 07:29 AM
Serving images kuvera Apache Tomcat 0 August 19th, 2006 12:02 PM
Serving ASP?? Oldon Classic ASP Basics 1 January 21st, 2005 06:41 PM
One instance of C# compo. serving multiple clients Nalin General .NET 1 January 14th, 2005 03:53 AM
How much faster is Apache serving HTML angrycat Apache Tomcat 1 September 27th, 2004 05:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.