PHP 5 limits "readfile" to 1.9 MB?

From: Date: Tue, 16 Aug 2005 21:06:23 +0000
Subject: PHP 5 limits "readfile" to 1.9 MB?
Groups: php.general 
Request: Send a blank email to php-general+get-220720@lists.php.net to get a copy of this message
Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download:
        // $file_to_read is the complete path of the file to download
        header("Content-Type: application/pdf");
        header( "Content-Disposition: inline; filename=\"$filename\"");
        $len = filesize($file_to_read);
        header("Content-Length: $len");
        @readfile($file_to_read);
php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On
max_execution_time = 300     ; Maximum execution time of each script, in seconds
max_input_time = 300    ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan

« previous php.general (#220720) next »