Note: the form on this page contains more than 1000 PHP MySql fields

I have a profile that was launched on the weekend. After reaching so many entries, PhpMyAdmin began to display this warning:

Note: the form on this page contains more than 1000 fields. When sending, some fields may be ignored due to the PHP max_input_vars configuration.

The table is called a survey and contains 10 columns and 300 rows of data - basically strings . I don’t understand where 1000 fields with number 1000 come from? Everything was fine, while about 150 entries were in the survey table. I worry, I will lose my data.

My profile consists of 20 pages with several answers. All values ​​are stored in $_SESSION then sent to the database on page 21.

Phpmyadmin

+9
source share
4 answers

You will not lose data. This error message indicates that you are trying to see the contents of a table and selecting too many rows at the same time. The number of columns in the table multiplied by the number of rows displayed should be lower than the value set for max_input_vars in your php.ini. The default value is 1000.

When you are working with your specific code, you should not encounter this error IF you are trying to do the same - display more than 1000 "elements" from the returned request at some point in time. Do you really want to do this? If so, be smart about paging your data and using LIMIT in your SQL query.

The data itself is safe. The only thing affected is the ability of PHP to extract and output.

+3
source

I just found that the new PHP does not have a decent default, and the php.ini variable max_input_vars is commented out. I uncommented this variable and it worked. Even leaving it at 1000.

+2
source
 max_input_vars integer How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). 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_WARNING is issued, and further input variables are truncated from the request. 

http://php.net/manual/en/info.configuration.php#ini.max-input-vars

Basically, "MAX_INPUT_VARS" limits the number of input values ​​that can be sent at a time.

For some reason, his statement contains more than 1000 variables sent when sending data to your server.

To get around this, increase the limit in your php configuration or ... change when you save the data. For example, each time they answer so many questions or when they complete an answer to a page, submit a form.

0
source

Use this configuration in php.ini :

 max_input_vars = 100000; 
0
source

Source: https://habr.com/ru/post/1208603/


All Articles