Reputation: 1395
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?
Upvotes: 116
Views: 479610
Reputation: 332
Put this line on .htaccess file of your site
php_value max_input_vars 6000
Upvotes: 6
Reputation: 529
If you are using something like wodby (docker4php
or docker4drupal
) or lando or trying to find an answer "why php.ini doesn't work" (like me), these tools are using their own way to pass configuration into php
https://github.com/wodby/php#php-and-php-fpm-configuration
I was trying to set max_input_vars, in wodby+docker-compose you do it like so
php:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_MAX_INPUT_VARS: 9999
Upvotes: 1
Reputation: 11
Just to complement. On a shared server using mod_suphp I was having the same issue.
Declaring 4 max_input_vars (suhosin included), didn't solved it, it just kept truncating on 1000 vars (default), and declaring "php_value max_input_vars 6000" on .htaccess threw error 500.
What solved it was to add the following on .htaccess, which applies the php.ini file recursively to that path
suPHP_ConfigPath /home/myuser/public_html
Upvotes: 1
Reputation: 305
"PHP message: PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.
This php configuration parameter max_input_vars will affect not only your GET / POST / COOKIES parameters it also controls your any Form Input.
To set or change its value follow the below steps.
1) check the existing setting / value by viewing it in your php.ini file Locate php.ini file by using
<?php echo getinfo(); ?>
find below key: Loaded Configuration File : /etc/php/5.6/fpm/php.ini
2) Open the php.ini file in editable mode and do search for max_input_vars This line may be commented in your existing default setting with default value of 1000 , So remove ; to uncomment it and Edit it with your suitable value e.g. 2500.
3) Save the file and Restart the Services of PHP by using below
sudo service php5.6-fpm restart
Similarly you can update any other similar PHP Configuration to your ease.
Upvotes: 2
Reputation: 21
Just had the same problem adding menu items to Wordpress. I am using Wordpress 4.9.9 on Ubuntu 18.04, PHP 7.0. I simply uncommented the following line and increased it to 1500 in /etc/php/7.0/apache2/php.ini
; How many GET/POST/COOKIE input variables may be accepted<br>
max_input_vars = 1500
Then used the following to effect the change:
sudo apache2ctl configtest #(if it does not return ok Apache will not start)
sudo service apache2 reload
Hope that helps.
Upvotes: 2
Reputation: 1
New Cpanels block to see the .htaccess file or if you add a .user.ini you wont be able to see it. but with a little hack you can make it work. Edit for example wp-config.php and in the URL bar replace wp-config.php by .htaccess now you can paste the values and save it. enter image description here
Upvotes: 0
Reputation: 2126
It's 2018 now.And I just got stuck on this problem when I must send a request that exceeds the max_input_vars
. And I came up with a solution that newie like me forgot to restart php fpm service after changing the max_input_vars
param. because I only tried to restart apache2
service, but not php fpm
/etc/php/7.0/fpm/php.ini
and set number as you wish max_input_vars = 4000
sudo service php7.0-fpm restart
Hope it helps
Tested on Debian Stretch
, php7.0
Upvotes: 17
Reputation: 893
Note that you must put this in the file ".user.ini" in Centos7 rather than "php.ini" which used to work in Centos6. You can put ".user.ini" in any subdirectory in order to affect only that directory.
.user.ini :
max_input_vars = 3000
Tested on Centos7 and PHP 5.6.33.
Upvotes: 3
Reputation: 4500
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
Upvotes: 124
Reputation: 51
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.
I can suggest not to extend the default value which is 1000 and extend the application functionality by serialising the request or send the request by blocks. Otherwise, you can extend this to configuration needed.
It definitely needs to set up in the php.ini
Upvotes: 5
Reputation: 333
Yes, add it to the php.ini, restart apache and it should work.
You can test it on the fly if you want to with ini_set("max_input_vars",100)
Upvotes: -6
Reputation: 14752
You can add it to php.ini and it should work - just tested it on PHP 5.3.6.
Upvotes: 55
Reputation: 657
You need to uncomment max_input_vars value in php.ini file and increase it (exp. 2000), also dont forget to restart your server this will help for 99,99%.
Upvotes: 9
Reputation: 962
Have just attempted this fix with 5.3.3 and there's no change. Googling around I found this web page http://anothersysadmin.wordpress.com/2012/02/16/php-5-3-max_input_vars-and-big-forms/ detailing other settings which need changing if your server uses the Suhosin patch which Apache under Debian does.
The site explains:
So, if you want to increase this number to, say, 3000 from the default number which is 1000, you have to put in your php.ini these lines:
max_input_vars = 3000 suhosin.post.max_vars = 3000 suhosin.request.max_vars = 3000
I tested it (added settings to php.ini both in /etc/php5/apache2 and /etc/php5/cli, and restarted Apache successfully) but still no max_input_vars variable in phpinfo.
A few sites point to PHP 5.3.9 as the first PHP version in which this change will take, so my fault for not RTM properly in the first place, although I'm interested to see people reporting it working in version above 5.3.3 but below 5.3.9.
Upvotes: 22