php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22154 fpassthru() fails with files larger than a few hundered KB
Submitted: 2003-02-10 17:08 UTC Modified: 2003-07-31 14:48 UTC
Votes:7
Avg. Score:5.0 ± 0.0
Reproduced:7 of 7 (100.0%)
Same Version:6 (85.7%)
Same OS:6 (85.7%)
From: malekjo at aphrodite dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.2 OS: Linux 2.4.18-10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: malekjo at aphrodite dot com
New email:
PHP Version: OS:

 

 [2003-02-10 17:08 UTC] malekjo at aphrodite dot com
Configure line for Apache module:
'./configure' '--with-apxs=/opt/IBMHTTPServer/bin/apxs' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-debug' '--with-config-file-path=/etc' '--with-pear' '--with-openssl' '--enable-magic-quotes' '--disable-short-tags' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--with-gdbm' '--with-ndmb' '--with-dom' '--enable-exif' '--enable-ftp' '--with-gettext' '--with-gmp' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-mcal=../libmcal' '--with-mhash' '--with-ldap=/home/joem/php/ldap' '--enable-shmop' '--with-snmp' '--enable-ucd-snmp-hack' '--enable-sockets' '--with-regex=system' '--enable-sysvsem' '--enable-sysvshm' '--enable-tokenizer' '--enable-wddx' '--enable-yp' '--enable-inline-optimization' '--enable-memory-limit' '--enable-sigchild' '--with-mysql=/home/joem/php/mysql'

Script:
<snip>
 $file = getCurrentFilename($product, $platform);
  if ($file != FALSE ) {
    $fp = fopen("../../../software/$file", 'rb');
    rewind($fp);
    header("Cache-control: private"); // another fix for IE
    header("Content-Type: application/x-stuffit");
    header("Content-Length: ".filesize("../../../software/$file"));
    header("Content-Disposition: attachment\; filename=\"$file\"");
    header("Connection: close");
    $fr = fpassthru($fp);
</snip>

fpassthru() seems to be wonky.  I'm trying to send .sit archives through this script.  The files are sent ok if they are ~300KB.  Other files that I need to send that are ~3.3MB fail.  IE reports a DNS error (bogus) and Galeon (Mozilla) reports File Contains no data.   PHP is running as an apache module in IBM HTTP Server 1.3.19.3 (Apache 1.3.20).  There is no core, and no error reported in httpd's error log.  The transfer log reports a 200 code for success.

Backtrace:
I don't get a SIGSEGV...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-26 19:48 UTC] iliaa@php.net
Do you have session.use_trans_sid option enabled in your php.ini?
 [2003-02-27 00:43 UTC] malekjo at aphrodite dot com
session.use_trans_sid = 1
 [2003-03-06 12:50 UTC] sniper@php.net
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-07-30 13:50 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

What's happening is very simple, you have a memory limit setting which prevents the script from completing the execution because it attempts to allocate more memory then it is allowed.
When this happens PHP will either terminate with E_ERROR or exit(1) printing the error message to stderr. The latter message you may be able to find inside your Apache's main error log.
 [2003-07-30 17:16 UTC] sniper@php.net
But it still can not crash. Reopened.

 [2003-07-31 14:48 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC