Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP max_input_vars

Tags:

php

I'm getting a max_input_vars error message.

I understand there's a php.ini setting that can change this starting with version 5.3.9 however, I'm running version 5.1.6.

When I view the configuration information for my 5.1.6 server it shows max_input_vars value is 1000.

My question is: Even though I'm running 5.1.6, I see this setting from phpinfo() but it's not in the php.ini file. Does this mean that the value is hard coded in this version of PHP and can't be changed?

like image 251
user39653 Avatar asked Apr 24 '12 18:04

user39653


People also ask

What is max_input_vars PHP?

The PHP variable max_input_vars was introduced in PHP 5.3. 9+ as a security measure to limit the maximum amount of POST variables submitted. It represents the number of variables your server can use to run a function. If the value of PHP input vars is not enough, you will get the max_input_vars error.

How do you fix PHP setting max_input_vars must be at least 5000?

If you created your own PHP. ini file, then add the same code inside it: max_input_vars = 5000 Simply change the value to the recommended value. For example, 5000. Save your changes, and reboot your localhost or your server.

How do you increase PHP max time limit and max input variables?

Max Input Vars can easily get increased by using a line of code. PHP max input vars is simply the number of variables your server is set to handle in each function. If you receive the error 'Increase PHP Max Input Vars Limit' in WordPress, you need to add the code 'php_value max_input_vars 3000' to your .


2 Answers

Reference on PHP net:

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

Please note, you cannot set this directive in run-time with function ini_set(name, newValue), e.g.

ini_set('max_input_vars', 3000); 

It will not work.

As explained in documentation, this directive may only be set per directory scope, which means via .htaccess file, httpd.conf or .user.ini (since PHP 5.3).

See http://php.net/manual/en/configuration.changes.modes.php

Adding the directive into php.ini or placing following lines into .htaccess will work:

php_value max_input_vars 3000 php_value suhosin.get.max_vars 3000 php_value suhosin.post.max_vars 3000 php_value suhosin.request.max_vars 3000 
like image 77
lubosdz Avatar answered Sep 23 '22 13:09

lubosdz


You can add it to php.ini and it should work - just tested it on PHP 5.3.6.

like image 36
Narf Avatar answered Sep 20 '22 13:09

Narf