ID:               22154
 User updated by:  malekjo at aphrodite dot com
 Reported By:      malekjo at aphrodite dot com
 Status:           Verified
 Bug Type:         Output Control
 Operating System: Linux 2.4.18-10
 PHP Version:      4.3.2-dev
 New Comment:

sorry...8192 bytes...


Previous Comments:
------------------------------------------------------------------------

[2003-03-07 17:36:32] malekjo at aphrodite dot com

Woohoo, I'm not the only one...

Raising the memory limit and setting output buffers to 8192K in php.ini
worked.  Though I am not happy with that solution.  Indicates to me
some mmap error of some sort.  Maybe something in glibc is mmapping the
file and creating artificially large buffer spaces in memory.

Here's what I found to "work"...though it still indicates a
buffer/memory bug to me:

function send_file($dir, $file){
  $fp = fopen("$dir/$file", 'rb');
  header("Cache-control: private, no-cache, no-store,
must-revalidate");
  header("Pragma: no-cache");
  header("Content-Type: application/x-stuffit");
  header("Content-Length: ".filesize("$dir/$file"));
  header("Content-Disposition: attachment; filename=\"$file\"");
  header("Connection: close");

  while(!feof($fp) and (connection_status() == 0)) {
    print(fread($fp, 8192));
    flush();
  }

  $status = (connection_status() == 0);
  fclose($fp);

  return($status);
}

This works with an 8M memory limit (I really don't want to have it any
higer, otherwise concurrent downloads will absolutely hammer on the
server) but needs output buffering turned on at 8192K.

------------------------------------------------------------------------

[2003-03-06 12:50:12] [EMAIL PROTECTED]

I get pretty wierd results with this script:

<?php

session_start();  // Comment this and it works fine..

$fp = fopen("test.zip", 'rb');
rewind($fp);
header("Cache-control: private"); // another fix for IE
header("Content-Type: application/x-stuffit");
header("Content-Length: ".filesize('test.zip'));
header("Content-Disposition: attachment\; filename=\"test.zip\"");
header("Connection: close");
$fr = fpassthru($fp);

?>

php,ini:
session.use_trans_sid = 1
memory_limit = 1M

And sending some file around 1M size will make it fail..









------------------------------------------------------------------------

[2003-03-05 15:27:12] [EMAIL PROTECTED]

Try raising the memory limit to 15-20 megs and see if the problem
persists.

------------------------------------------------------------------------

[2003-02-27 00:43:22] malekjo at aphrodite dot com

session.use_trans_sid = 1

------------------------------------------------------------------------

[2003-02-26 19:48:20] [EMAIL PROTECTED]

Do you have session.use_trans_sid option enabled in your php.ini?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/22154

-- 
Edit this bug report at http://bugs.php.net/?id=22154&edit=1

Reply via email to