php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45448 PHP Cuts off documents after some point
Submitted: 2008-07-07 22:55 UTC Modified: 2008-07-15 22:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jowie dot 1337+phpnet at gmail dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.6 OS: Windows XP Service Pack 1
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: jowie dot 1337+phpnet at gmail dot com
New email:
PHP Version: OS:

 

 [2008-07-07 22:55 UTC] jowie dot 1337+phpnet at gmail dot com
Description:
------------
All my php documents are cut off after exactly 8800 bytes. The content does not matter, it even happens on documents that have no php code at all.

There are no errors (E_ALL) from php, nor from apache.

Renaming .php to .txt shows the whole file in my browser.
This also happends with an unmodified php.ini (php.ini-recommended, besides extension_dir)

I have tried the following scenario's (restarted apache for each try):

+ Apache 2.2.9 PHP 4.4.8 as Module (bug appears)
+ Apache 2.2.9 PHP 5.2.6 as Module (bug appears)
+ Apache 2.2.9 PHP 5.2.6 under CGI (bug appears)
+ Apache 2.2.9 PHP 4.4.8 implicit_flush on (NO BUG)
+ Apache 2.2.9 PHP 5.2.6 Without ANY Extensions (bug appears)
+ Apache 2.2.9 PHP 5.2.6 implicit_flush on (bug appears)
+ Apache 2.2.9 PHP 5.2.6 output_buffering off (bug appears)
+ Apache 2.2.9 PHP 4.4.8 Super high memory_limit (bug appears)
+ Apache 2.2.9 PHP 5.2.6 Super high memory_limit (bug appears)

As you can see, for some reason if I turn implicit_flush on in php 4, the bug disappears, i can see the whole document(s).


I have seen a different site where this happened. However it did not appear on every document and at various cut-off lengths. This may be a different bug perhaps unrelated to php but it is worth mentioning.
I only have the following limited info about that server:
OS: Some Linux Flavor; Apache 2.0.54 (Fedora); PHP 5.0.4 as a module

Reproduce code:
---------------
A text document containing more then 8800 characters saved as test.php

Expected result:
----------------
The whole text document

Actual result:
--------------
A text document that is cut off at 8800 characters

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-08 13:13 UTC] jani@php.net
Which apache2 SAPI are you using?
 [2008-07-08 16:01 UTC] jowie dot 1337+phpnet at gmail dot com
This is a snippet of my httpd.conf related to php, this is the same as I used to test the scenario's in my opening post:


AddType application/x-httpd-php .php

LoadModule php4_module "C:/Program Files/PHP 4/php4apache2.dll"
PHPIniDir "C:/Program Files/PHP 4/" 

#PHPIniDir "C:/Program Files/PHP 5/"
#LoadModule php5_module "C:/Program Files/PHP 5/php5apache2_2.dll"
 [2008-07-11 15:33 UTC] jani@php.net
You're actually using PHP 4..? The support for PHP 4 has ended, so if you could actually try with PHP 5 first..
 [2008-07-11 15:36 UTC] jani@php.net
Also: What other filters/modules have you enabled in your apache config?
 [2008-07-12 22:19 UTC] jowie dot 1337+phpnet at gmail dot com
I am trying both, however since PHP 5 is unworkable for me because I can not find a workaround for the bug, I am using php 4.
 
In the opening post I stated the combinations I tried, PHP 4 and PHP 5. The bug is exactly the same in both versions.


I have configured no filters in apache

Loaded Apache Modules:
mod_actions.so
mod_alias.so
mod_asis.so
mod_auth_basic.so
mod_authn_default.so
mod_authn_file.so
mod_authz_default.so
mod_authz_groupfile.so
mod_authz_host.so
mod_authz_user.so
mod_autoindex.so
mod_cgi.so
mod_dav.so
mod_dir.so
mod_env.so
mod_include.so
mod_isapi.so
mod_log_config.so
mod_mime.so
mod_mime_magic.so
mod_negotiation.so
mod_setenvif.so
mod_ssl.so
 [2008-07-13 17:39 UTC] jani@php.net
Try disabling every module first. And if the bug vanishes, check which module causes the problem.
 [2008-07-14 17:57 UTC] jowie dot 1337+phpnet at gmail dot com
I just tried it without ANY module loaded EXCEPT mod_mime, the bug still appeared.

Nothing abnormal in error.log


This is the httpd.conf I used for this test:

ServerRoot "C:/Program Files/Apache2.2"
Listen 80
ServerAdmin removed@removed.removed
ServerName removed.removed
DocumentRoot "D:/Test"

<Directory "D:/Test">
    Options None
    AllowOverride None
</Directory>

ErrorLog "logs/error.log"
LogLevel debug
LoadModule mime_module modules/mod_mime.so
DefaultType text/plain
AddType application/x-httpd-php .php
PHPIniDir "C:/Program Files/PHP 5/"
LoadModule php5_module "C:/Program Files/PHP 5/php5apache2_2.dll"
 [2008-07-14 18:22 UTC] jani@php.net
Try without any php.ini file anywhere in your system (check phpinfo() that nothing is loaded!)
 [2008-07-14 19:39 UTC] jowie dot 1337+phpnet at gmail dot com
Bug still occurs. I used the same httpd.conf as in my previous post ([14 Jul 5:57pm UTC])

phpinfo() tells me 
Loaded Configuration File: (none)
 [2008-07-14 19:42 UTC] jowie dot 1337+phpnet at gmail dot com
It may be worth noting that everything is fine when I run a php script of the console using "php.exe test.php".
 [2008-07-14 20:53 UTC] jani@php.net
Are you sure there's actually something crashing there? Nothing in Apache logs or wherever those are in Windows..?
 [2008-07-15 19:20 UTC] jowie dot 1337+phpnet at gmail dot com
Using the same httpd.conf as in my post from [14 Jul 5:57pm UTC] (besides the addition of an access log), my log file shows the following:

[Tue Jul 15 20:53:04 2008] [notice] Apache/2.2.9 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Tue Jul 15 20:53:04 2008] [notice] Server built: Jun 13 2008 04:04:59
[Tue Jul 15 20:53:04 2008] [notice] Parent: Created child process 2692
[Tue Jul 15 20:53:04 2008] [debug] mpm_winnt.c(487): Parent: Sent the scoreboard to the child
[Tue Jul 15 20:53:04 2008] [notice] Child 2692: Child process is running
[Tue Jul 15 20:53:04 2008] [info] Parent: Duplicating socket 200 and sending it to child process 2692
[Tue Jul 15 20:53:04 2008] [debug] mpm_winnt.c(408): Child 2692: Retrieved our scoreboard from the parent.
[Tue Jul 15 20:53:04 2008] [debug] mpm_winnt.c(605): Parent: Sent 1 listeners to child 2692
[Tue Jul 15 20:53:04 2008] [debug] mpm_winnt.c(564): Child 2692: retrieved 1 listeners from parent
[Tue Jul 15 20:53:04 2008] [notice] Child 2692: Acquired the start mutex.
[Tue Jul 15 20:53:04 2008] [notice] Child 2692: Starting 64 worker threads.
[Tue Jul 15 20:53:04 2008] [notice] Child 2692: Starting thread to listen on port 80.
== I visit test.php once, document is cut off ==

== Access log shows: ==
xxx.xxx.xxx.xxx - - [15/Jul/2008:20:53:08] "GET /test.php HTTP/1.1" 200 14385 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0"

== I stop the apache service ==
[Tue Jul 15 20:53:15 2008] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Tue Jul 15 20:53:15 2008] [notice] Child 2692: Exit event signaled. Child process is ending.
[Tue Jul 15 20:53:16 2008] [info] Child 2692: Accept thread exiting.
[Tue Jul 15 20:53:16 2008] [notice] Child 2692: Released the start mutex
[Tue Jul 15 20:53:16 2008] [info] Child 2692: 64 threads blocked on the completion port
[Tue Jul 15 20:53:17 2008] [notice] Child 2692: All worker threads have exited.
[Tue Jul 15 20:53:17 2008] [notice] Child 2692: Child process is exiting
[Tue Jul 15 20:53:17 2008] [notice] Parent: Child process exited successfully.
[Tue Jul 15 20:53:17 2008] [info] removed PID file C:/Program Files/Apache2.2/logs/httpd.pid (pid=3064)


PHP log file is empty.
apache.exe does not crash, I verified this by running httpd.exe from the command line instead of a service
 [2008-07-15 21:03 UTC] jani@php.net
And the test.php file has no code? No <?php ?> tags? For some reason I'm starting to think you're just screwing with us and this is completely bogus thing..I can't reproduce anything like this with the default install of latest Apache 2 and PHP installed on a fresh system -> conclusion: There's something wrong with your machine. If you can reproduce this reliably with some other machine and provide reliable proof about it, reopen. Until that -> BOGUS.
 [2008-07-15 22:59 UTC] jowie dot 1337+phpnet at gmail dot com
My test file contains no php code, the only thing it contains is plain text generated by www.lipsum.com. It happens with _every_ php file where the output is over a specific size, having the extension .php is enough to trigger this.

I am not screwing with you, I am spending time trying to provide you with information so it could hopefully be resolved. And seriously, how and why would I make this up.

The server this is running on has just been formatted and reinstalled. If it is the server, it has to be something hardware related that screws up with the windows+apache+php combo. I will be happy to provide the specifications of the machine if I can locate them.

I have no idea how to reproduce it on another machine, all I know that it happens 100% of the time on the machine in question. It also provides a lot of other services, which experience no such problems at all.

And why is the output always around 8800 bytes?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 14:01:30 2024 UTC