Bug #45945 [Com]: Apache byterange output filter nullified if mod_php5 output > 8000 bytes

From: Date: Sun, 13 Sep 2020 11:51:26 +0000
Subject: Bug #45945 [Com]: Apache byterange output filter nullified if mod_php5 output > 8000 bytes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228991@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45945&edit=1

 ID:                 45945
 Comment by:         masterofsql at emailfromgoogle dot com
 Reported by:        djimenez at conduit-it dot com
 Summary:            Apache byterange output filter nullified if mod_php5
                     output > 8000 bytes
 Status:             Open
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Ubuntu
 PHP Version:        5.*, 6CVS (2009-07-15)
 Block user comment: N
 Private report:     N

 New Comment:

I hope someone will find this useful
EXPLICITLY adding

header("Transfer-Encoding: chunked");

solved the problem (not sure how reliably though).
That Transfer-Encoding header was being added automatically even if i didn't set it - but the
problem was there. Adding the header explicitly in PHP code solved it.
Tested using websniffer.cc, PHP 7.4.9 CentOS 7.8


Previous Comments:
------------------------------------------------------------------------
[2012-11-15 11:49:09] richard_s_yeo at hotmail dot com

Has there been any update to this?
I am experiencing the same issue on Windows and Linux with 5.3.5 of php.
This is a very important issue for me and the workaround of using redirect won't 
work for me.

------------------------------------------------------------------------
[2010-03-24 10:02:46] thwien at gmx dot net

I can confirm this problem. Exactly over 8000 Bytes it does not work anymore. Also using the Apache
module x-sendfile does not solve this error in my case. The one and only work-around in my case is a
header call with location of a static url.

header('Location: http://any.url/toanyfile.html');
exit;

After this just Apache controls the range operator and it works as expected.

------------------------------------------------------------------------
[2009-10-13 21:30:08] dylan at io dot com

I have found that using sing X-Sendfile will solve this issue:
http://tn123.ath.cx/mod_xsendfile/
(at least for Apache/mod_php).

Also even if this "bug" was fixed, I'm not sure the results would be 
very desirable.  Since there's no way to efficiently "fseek" to a 
particular byte in the script output, I assume mod_php would have to 
transfer the entire document internally for each chunk that was 
requested.

------------------------------------------------------------------------
[2009-09-16 14:15:21] djimenez at conduit-it dot com

Using the handler module:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3 .html .inc .func 
.clss
  AddType application/x-httpd-php-source .phps
</IfModule>

------------------------------------------------------------------------
[2009-09-16 12:35:33] jani@php.net

Are you using the filter or handler module? What exactly do you put in 
your httpd.conf to enable PHP?

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


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

    https://bugs.php.net/bug.php?id=45945


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


Thread (14 messages)

« previous php.bugs (#228991) next »