$_POST 中偶尔会缺少 textarea,但 content_length 总是正确的?

发布于 2024-07-28 04:46:35 字数 671 浏览 3 评论 0原文

运行相当活跃的站点的服务器上出现了一个奇怪的错误。

  • 服务器:Apache/2.2.3 (CentOS)
  • PHP:5.2.6
  • eAccelerator 0.9.5.3

在使用多部分表单时,从文本区域发送的数据偶尔会在 $_POST 中丢失

我们知道数据已发送,因为 content_length 显示了合理的大小1K

表单中的所有其他输入字段均已正确接收。

它不是特定于浏览器的,发生在 IE/Firefox/Chrome 上。

几乎 99% 的时间都有效,平均每发布 100 个帖子才会失败 1 到 2 次。

在非常罕见的情况下,我们能够自己重现它,因此我们知道数据正在发送,只是没有被 apache/php 处理

所有这些设置都已经过检查并且是合理的 在 php.ini 中:

memory_limit
max_input_time
upload_max_file_size
post_max_filesize

在 httpd.conf 中

LimitRequestBody
TimeOut

我很想听听其他想法,这可能是什么。 我找不到任何已知的 PHP 相关错误。

A strange bug has popped up on a server running a fairly active site.

  • Server: Apache/2.2.3 (CentOS)
  • PHP: 5.2.6
  • eAccelerator 0.9.5.3

While using multipart forms, occasionally data sent from a textarea will be missing in the $_POST

We know the data was sent because content_length shows a reasonable size over 1K

All other input fields in the form are properly received.

It is NOT browser specific and happens on IE/Firefox/Chrome.

Works nearly 99% of the time, only fails 1 or 2 times on average for every hundred posts made.

On very rare occasion we've been able to reproduce it ourselves so we know data is being sent, just not processed by either apache/php

All of these settings have been checked and are reasonable
in php.ini:

memory_limit
max_input_time
upload_max_file_size
post_max_filesize

in httpd.conf

LimitRequestBody
TimeOut

Would love to hear other ideas what this might be.
I cannot find any known related bug for PHP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慕巷 2024-08-04 04:48:04

不确定这是问题所在(不是一个容易猜到的问题 ^^ ),但如果您有 suhoshin 安全补丁/扩展,您是否尝试停用它?

(我不知道它在 CentOS 上是否默认激活,但考虑到它是在“不太面向企业”的 Ubuntu 上,它可能是默认激活的)

我建议这样做是因为此错误报告,其中有一些注释例如:

[世界标准时间 2007 年 10 月 30 日上午 11:02] 斯鲍尔于
gjl-网络点网

我们也遇到过这个问题
发现这个问题的原因
是 suhosin 补丁,是 - by
默认 - 配置为有一个最大值
cookie 的长度限制,
请求、发布、获取和会话变量。
例如,对于 POST,如下所示:

suhosin.post.max_array_深度 100
100
suhosin.post.max_array_index_length 64
第64章 64
64 suhosin.post.max_totalname_length
第256章 256
65000 65000 suhosin.post.max_vars
200 200

这些导数需要设置为
足够高的数量。 例如在我们的
案例,问题是,我们的帖子
数据太长(因为这似乎是
你们很多人都是这样)。

所以我建议检查你的 php.ini 或
(根据你那里的分布
通常是 suhosin.ini)并且正确
上述值或将它们设置为 0 即可
禁用它。 如果这些导数是
未设置,将使用默认值。
您需要检查/添加:
suhosin.post.max_....
suhosin.request.max_...
suhosin.get.max_...
suhosin.session.max_...
suhosin.cookie.max_...

请参阅您的 phpinfo() 其中这些
应该列出值!

和/或:

[世界标准时间 2008 年 11 月 13 日下午 4:58] 基思
tdrnetworks.com

关于
enctype="multipart/form-data" 不
填充 $_POST 变量我发现我的
解决方案是禁用 Suhosin
安全模块。

试试吧!

还有一个注释说:

[世界标准时间 2 月 5 日下午 6:49] 尼尔·多特·普莱斯利
在 yahoo dot com

我也遇到了同样的问题。 我曾有一个
带有 php 脚本的 html 表单,其中我
正在提交单选按钮或
复选框。 当我发布表单时,PHP
没有找到任何后置参数。
这是随机的,有时是
工作,有时不工作。 甚至我
尝试使用 Get,它工作了一段时间
有时则不然。 然后我改变
ENCTYPE 从大写到小写
它开始正常工作

您的表单/页面 HTML 有效吗? 也许,在某些罕见的情况下,事实并非如此?

也许这会有所帮助...如果没有,我很想知道这个问题的原因!

Not sure this is the problem (not an easy to guess question ^^ ), but if you have the suhoshin security patch/extension, did you try de-activating it ?

(I don't know if it's activated by default on CentOS, but it might be, considering it is on Ubuntu, which is "less entreprise oriented")

I'm suggesting this because of this bug report, in which there are a couple of notes which say, for instance :

[30 Oct 2007 11:02am UTC] sbauer at
gjl-network dot net

While experiencing this issue, too we
found that the cause of this problem
was the suhosin patch, wich was - by
default - configured to have a max
limit for the length of cookie,
request, post, get and session vars.
E.g. for POST this looks like:

suhosin.post.max_array_depth 100
100
suhosin.post.max_array_index_length 64
64 suhosin.post.max_name_length 64
64 suhosin.post.max_totalname_length
256 256 suhosin.post.max_value_length
65000 65000 suhosin.post.max_vars
200 200

Those derivatives needs to be set to a
adequate higher number. E.g. in our
case, the problem was, that our POST
data was too long (as this seems to be
the case for a lot of you here).

So I suggest to check your php.ini or
(according to your distribution there
often is a suhosin.ini) and correct
the above values or set them to 0 to
disable it. If those derivatives are
not set, default values will be used.
You need to check / add:
suhosin.post.max_....
suhosin.request.max_...
suhosin.get.max_...
suhosin.session.max_...
suhosin.cookie.max_...

Refer to your phpinfo() where these
values should be listed!

And / or :

[13 Nov 2008 4:58pm UTC] keith at
tdrnetworks dot com

Regarding the
enctype="multipart/form-data" not
populating the $_POST vars I found my
solution was to disable the Suhosin
security module.

Have a go!

There is also a note which says :

[5 Feb 6:49pm UTC] neal dot pressley
at yahoo dot com

I was facing the same problem. I had a
html form with php scripts in which I
was submitting radio buttons or
checkboxes. When I post the form, PHP
was not finding any post parameters.
it was random, some time it was
working and some time not. Even I
tried with Get, it worked some time
and some time not. Then I change
ENCTYPE from uppercase to lowercase
and it started working prefectly

Is your form / page HTML-valid ? Maybe, in some rare cases, it's not ?

Maybe this'll help... If not, I'm curious to know the reason of this problem !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文