Since PHP 5.3.9 a new php.ini option was added called
max_input_vars. It is part of the run-time configuration and in most cases this won’t be a problem. But some users have found that when they are saving large amounts of data, nothing happens.
Upon enabling Display errors they find this is being outputted each time they hit the save button.
Warning: parse_str() [function.parse-str]: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in/home/user/public_html/path/t0/file/causing/this/error.php on line 459
What is Max Input Vars?
It limits the number of
input variables, this limit affects
$_COOKIE superglobal separately.
What would be affect by this limit?
The main item to be affected would be forms, and they can come in many forms ( no pun intended).
- Large Forms (such as a survey form, or a detailed contact form)
- Option Forms, such as a theme or plugin options page.
What is the purpose of Max Input Vars?
The main purpose of Max Input Vars is to help mitigate the possibility of denial of service attacks which use hash collisions.
How can we Increase Max Input Vars?
The default value is set to 1000
In some cases we may need to raise this or we will be unable to save our data.
To increase this value you will need to edit your php.ini file usually located in /usr/local/lib
Note – as far as I am aware shared hosts will not allow you to edit this value, even if you have a local php.ini file located in your public_html folder.
In that case you will either have to
- Move to a VPS or Dedicated server
- Reduce the total number of input variables
- Revert your PHP back to a pre 5.3.9 version
If you have a VPS or dedicated server, you can either ask your host to increase the value for you, don’t go crazy with it, 3000 should be a good number, as it is there for a reason.
If you are comfortable with editing php.ini then you can login with SSH or SFTP and located you php.ini file and add the following.
max_input_vars = 3000 suhosin.post.max_vars = 3000 suhosin.request.max_vars = 3000
I would first search for max_input_vars to see if it already exists, if not just add the above.
You can check to see if it working by creating a php info file.
Create a file called info.php and add the following.
<?php phpinfo(); ?>
upload it to your public_html folder.
The type www.yoursitename.com/info.php
Scroll down to Core and you will see the max_input_vars and the new value should be shown like so.
Don’t forget to delete the php info file later as it contains a lot of valuable data that you may not want others to see.Note: You must restart Apache in order for the changes to take affect.