ID:               22154
 Updated by:       [EMAIL PROTECTED]
 Reported By:      malekjo at aphrodite dot com
 Status:           Verified
-Bug Type:         Output Control
+Bug Type:         Session related
 Operating System: Linux 2.4.18-10
 PHP Version:      4.3.2-dev
 New Comment:

Just keep the category as session related, as this is caused
by the trans-sid feature..



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

[2003-03-07 17:41:15] malekjo at aphrodite dot com

sorry...8192 bytes...

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

[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

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

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