Sakthivel
Sakthivel

Reputation: 131

How to change max_input_vars

I have a form with over 1000 inputs, it shows warning below:

Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0

I have changed max_input_vars to more than 1500 in php.ini file but it does not take effect and shows the same error.

My project details:

How can I clear this warning?

Upvotes: 8

Views: 56935

Answers (7)

frmbelz
frmbelz

Reputation: 2543

I had the same error on Fedora. You can try finding php.ini with

php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

After changing /etc/php.ini with

max_input_vars = 5000

error would not go away even after max_input_vars changed. Appears it is not enough to restart web server (apache in my case)

sudo systemctl restart httpd

also needed to

sudo systemctl restart php-fpm.service

Upvotes: 0

Mounish Ambaliya
Mounish Ambaliya

Reputation: 351

For CentOs server - Search for php.ini file loaded using below command :

php -i | grep "Loaded Configuration File"

It displays's the loaded configuration file as per below :

Loaded Configuration File => /etc/php.ini

Edit the file using vi / vim any command, search for : max_input_vars

Default value shall : 1000, Change it to : 2000 or as per your requirement and Restart the PHP on server.

Works like charm for me always.

Upvotes: 2

Hitesh Tripathi
Hitesh Tripathi

Reputation: 854

Add below code in your .htaccess file

php_value max_input_vars 2000

you can change value of 2000 to as per your need

Upvotes: 4

ASH
ASH

Reputation: 77

First call phpinfo() function than you will see:

max_input_vars = 1000

set ini_set('max_input_vars','2000' ); in function and restart Apache server.

Upvotes: -1

Krunal Modi
Krunal Modi

Reputation: 1

convert array to string with comma separate from view using java script, then pass value to controller as string & split value to specific character in controller & convert string to array in controller.

in Javascript : array store in list variable

var str = "";
for(var i=0;i<list.length;i++)
{
	str = str + list[i] + ',';
}
var len = str.length;
return str.substring(0,len-1);


in PHP
explode this string  & convert to array.
$searchValue = explode(",", $searchValue);

Upvotes: 0

jignesh vasoya
jignesh vasoya

Reputation: 383

Variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 This Type of error Sloved the first to open php.ini file and after find "max_input_vars" Syntex and After his limit to 1000 to incres and 2000 set.

Upvotes: -2

Jayesh Dhudashia
Jayesh Dhudashia

Reputation: 397

ASH's suggested

ini_set('max_input_vars','2000' );

but this never work with ini_set. You need to set it with php.ini or .htaccess file only.

Upvotes: 12

Related Questions