gpt4 book ai didi

php - textarea 偶尔会在 $_POST 中丢失,但 content_length 总是正确的?

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:46:10 26 4
gpt4 key购买 nike

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

  • 服务器:Apache/2.2.3 (CentOS)
  • PHP:5.2.6
  • 电子加速器 0.9.5.3

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

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

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

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

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

在极少数情况下,我们能够自己重现它,所以我们知道数据正在发送,只是没有被 apache/php 处理

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

memory_limit
max_input_time
upload_max_file_size
post_max_filesize

在 httpd.conf 中

LimitRequestBody
TimeOut

很想听听其他想法。我找不到任何已知的 PHP 相关错误。

最佳答案

不确定这是问题所在(不是一个容易猜到的问题 ^^ ),但如果你有 suhoshin安全补丁/扩展,你试过停用它吗?
(我不知道它在 CentOS 上是否默认激活,但考虑到它在 Ubuntu 上,它可能是“不太面向企业的”)

我建议这样做是因为 this bug report ,其中有几个注释,例如:

[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!

和/或:

[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!

还有一条注释说:

[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

您的表单/页面 HTML 有效吗?也许,在极少数情况下,不是?


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

关于php - textarea 偶尔会在 $_POST 中丢失,但 content_length 总是正确的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1192055/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com