PHP 警告:未知:输入变量超过 1000

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9673895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:24:07  来源:igfitidea点击:

PHP Warning: Unknown: Input variables exceeded 1000

phpcentos

提问by Jon

I am getting a new php warning when a POST data from a form on my page to my server. The warning is as follows:

当我的页面上的表单将 POST 数据发送到我的服务器时,我收到一个新的 php 警告。警告如下:

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: https://mywebsite.com/index.php

PHP 警告:未知:输入变量超过 1000。要增加限制更改 php.ini 中的 max_input_vars。在第 0 行的未知中,引用者:https: //mywebsite.com/index.php

The thing is that my form does not have near 1000 input variables, so I am baffled as to why this is appearing. As a side note, I have not had this problem until recently and I suspect that when I ran yum updatesomething changed/was installed that is causing this. Any advice or answers are appreciated.

问题是我的表单没有近 1000 个输入变量,所以我很困惑为什么会出现这种情况。作为旁注,直到最近我才遇到这个问题,我怀疑当我运行yum update某些更改/安装导致此问题的东西时。任何建议或答案表示赞赏。

EDIT 1: So I did var_dump($_REQUEST)and got ~1000 single character strings. The first couple items in the array are what they should be, but then a bunch of stuff that I don't need submitted is broken down into single character strings. Thoughts welcome.

编辑 1:所以我做了var_dump($_REQUEST)并得到了大约 1000 个单字符串。数组中的前几个项目应该是它们应该是什么,但是然后一堆我不需要提交的东西被分解成单个字符串。欢迎提出想法。

array(1001) { 
    ["action"]=> string(10) "step1_show" 
    ["submit"]=> string(6) "Step 1" 
    [0]=> string(1) "a" 
    [1]=> string(1) "c" 
    [2]=> string(1) "t" 
    [3]=> string(1) "i" 
    [4]=> string(1) "o" 
    [5]=> string(1) "n" 
    [6]=> string(1) "=" 
    [7]=> string(1) "l" 
    [8]=> string(1) "o" 
    [9]=> string(1) "g" 
    [10]=> string(1) "o" 
    [11]=> string(1) "u" 
    [12]=> string(1) "t" 
    [13]=> string(1) "&" 
    [14]=> string(1) "p" 
    [15]=> string(1) "r" 
    [16]=> string(1) "o" 
    [17]=> string(1) "p" 
    [18]=> string(1) "e" 
    [19]=> string(1) "r" 
    [20]=> string(1) "t" 
    [21]=> string(1) "y" 
    [22]=> string(1) "=" 
    [23]=> string(1) "3" 
    [24]=> string(1) "7" 
    [25]=> .....     

ANSWER: It ended up being a problem with my submit handler. Thanks all for your input.

ANSWER:它最终成为我的提交处理程序的问题。感谢大家的投入。

回答by hakre

That's a new setting / value in PHP (related to a security update to prevent attacks to PHP scripts), so you get this after the update (before PHP 5.3.9 not set/available, suhosinusers have a similar thing since ages).

这是 PHP 中的一个新设置/值(与防止对 PHP 脚本攻击的安全更新有关),因此您可以在更新后获得此设置(在 PHP 5.3.9 未设置/可用之前,suhosin用户自古以来就有类似的东西)。

Input values are of different kinds and array members count as well. So it's not enough to count form fields but also to take a look into the URL and other places related to input ($_GET, $_POST, $_SERVER, $_ENV, $_FILES, $_COOKIE...).

输入值有不同的种类,数组成员也计数。因此,仅计算表单字段是不够的,还要查看 URL 和其他与输入相关的地方 ( $_GET, $_POST, $_SERVER, $_ENV, $_FILES, $_COOKIE...)。

See max_input_vars:

max_input_vars

How many input variablesmay be accepted. Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNINGis issued, and further input variables are truncated from the request. This limit applies only to each nesting level of a multi-dimensional input array.

可以接受多少输入变量。使用此指令可以减少使用哈希冲突的拒绝服务攻击的可能性。如果输入变量多于该指令指定的数量,E_WARNING则发出an ,并从请求中截断更多的输入变量。此限制仅适用于多维输入数组的每个嵌套级别。

回答by Himal Majumder

There is two way to solve this problem.

有两种方法可以解决这个问题。

.htaccess

.htaccess

php_value max_input_vars 10000

php

php

ini_set('max_input_vars','10000' );

回答by Luke Dohner

I fixed the max_input_vars issue via my web host admin panel (Littleoak) I changed the max_input_vars = 0to max_input_vars = 6000. There are several installations of php on my server that the server company configured. I believe the max_input_vars = 0is to prevent email spammers from using the server to send spam. The php.ini file lives somewhere, not sure where, but I was able to modify it via the cPanel on my site admin.

我通过我的网络主机管理面板 (Littleoak) 修复了 max_input_vars 问题,我max_input_vars = 0max_input_vars = 6000. 服务器公司在我的服务器上安装了几个php。我相信这max_input_vars = 0是为了防止垃圾邮件发送者使用服务器发送垃圾邮件。php.ini 文件位于某处,不确定在哪里,但我可以通过站点管理员的 cPanel 对其进行修改。