Red Hat Bugzilla – Bug 82967
POST body corruption in some configurations
Last modified: 2007-04-18 12:50:25 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
Description of problem:
The following code results in a corrupted upload...
<form action="send.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
Attachment<input type="file" name="attachment" size="20"><br>
<input type="submit" value="send">
The corrupted file is approximately twice the size of the original.
Version-Release number of selected component (if applicable):
Please attach send.php too. How big was the file you tried to upload?
Created attachment 89706 [details]
Send.php as requested
This copies the uploaded file to the original filename in the tmp directory.
This works fine on apache 1.3.23-4 running on RH8 but does not work with Apache
If the file is greater than about 2K then parts of the original are repeated in
the upload data, resulting in a corrupted file about twice the size.
I can't reproduce any problems using Mozilla to upload a selection of files
using that script. What browser are you using?
The behaviour occurs with both mozilla-1.2 and I.E. 6.
Some other accounts of the problem can be found at:
We asked Derek if he had found a solution, and he said that he had to revert to
apache 1.x series.
I can't seem to find the source at the moment, but I read that it appears to be
a problem with mod_php on the apache 2.X series, as the same version of php
works fine with the 1.X series.
Thanks for your help,
Can you get a network trace of the form upload? (e.g. using ethereal or tcpdump)
I can't reproduce this with Mozilla 1.2.1 either.
It seems to work fine with the recently released php errata packages.
thanks for your help.
OK, that's weird, but good.
Please see the thread at http://bugs.php.net/bug.php?id=18648 the problem is (as
described by email@example.com) because /etc/httpd/conf.d/php.conf has 2 filters
replace above lines with
AddType application/x-httpd-php .php
solve the problem for me
Did you already have a similar AddType directive in httpd.conf? Can you attach a
/etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/php.conf which let you
reproduce the bug?
Oh...Yes, I already have similar AddType in /etc/httpd/conf/httpd.conf (from
rpm, unmodified) So I just try removing
AddType application/x-httpd-php .php
that I added to /etc/httpd/conf.d/php.conf and it also work. My php.conf
content is below
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
LoadModule php4_module modules/libphp4.so
# Cause the PHP interpreter handle files with a .php extension.
# SetOutputFilter PHP
# SetInputFilter PHP
# LimitRequestBody 524288
#AddType application/x-httpd-php .php
# Add index.php to the list of files that will be served as directory
The default 8.0 httpd.conf does not contain an AddType for PHP - have you
upgraded from 7.x maybe?
We should be able to cope better with this config problem.
No, not an upgrade from and oops...yes, I have modified /etc/httpd/conf/httpd.conf to add that AddType for php a couple of weeks ago.. to test php-4.3, sorry. So the solution for this problem should be removing the lines from <Files *.php> to </Files> and use AddType application/x-httpd-php .php instead?
Use either the AddType *or* the original <Files *.php> section in php, just
don't use both, as the PHP bug explains. (They are pretty much equivalent)
The workaround for this bug is going to be included in a forthcoming PHP erratum.
*** Bug 85406 has been marked as a duplicate of this bug. ***
*** Bug 85386 has been marked as a duplicate of this bug. ***
Apologies for the noise while I tweak the Summary again.
*** Bug 97430 has been marked as a duplicate of this bug. ***
An errata has been issued which should help the problem described in this bug report.
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen
this bug report if the solution does not work for you.
*** Bug 97647 has been marked as a duplicate of this bug. ***
*** Bug 76559 has been marked as a duplicate of this bug. ***
*** Bug 77500 has been marked as a duplicate of this bug. ***
*** Bug 113369 has been marked as a duplicate of this bug. ***