Website Forms not saving in Wordpress, Drupal or PHP

On very large forms (with lots of form elements) you can find that your form does not save. This is due to a PHP setting max_input_vars. The default setting for this is usually 1000. That means that if the form has more than 1000 elements then elements past 1000 will be omitted. Therefore the form can save partially.

This can be particularly prevalent in permissions forms that have multiple roles and multiple permissions e.g. 100 permissions and ten roles will take you to the limit quite easily.

There are various ways to change this setting either in your php.ini file max_input_vars = 4000 or it can be put in a .htaccess file php_value max_input_vars 4000.

If you are changing your Apache server configuration in php.ini then you probably know what you are doing, if not then the exact steps may vary but will probably be something like:
* locate php.ini This shows you where your php.ini is
* sudo nano /etc/php5/apache2/php.ini Use the path from above
* Change ; max_input_vars = 1000 to max_input_vars = 4000 or another appropriate number
* Save and quit
* Restart Apache sudo apache2ctl restart

The downside? Yes there is some. The PHP documentation says that a large setting can make your site more susceptible to denial of service attacks.

Post new comment

By submitting this form, you accept the Mollom privacy policy.

User login

Author of...

  • search for 'search' on google.com and bing comes up first!?!?!?! 12 years 34 weeks ago
  • A genius, high value tip/test for #Drupal #continuousintegration with #Jenkins and #selenium if I do say so myself goo.gl/IGIy5 12 years 34 weeks ago
  • @philhawksworth Damn it! Someone beat me to it! 12 years 35 weeks ago
  • A short post I just wrote on setting up #Memcache for #Drupal: goo.gl/2VnUc 12 years 37 weeks ago
  • Seems ftp.drupal.org is down, but you can still download modules by hacking the download link to remove ftp. #drupal 12 years 37 weeks ago
  • dear #lazyweb #phpundercontrol ( #cruisecontrol ) or #jenkins for #drupal #continuousintegration 12 years 38 weeks ago
  • You've got to have some nuts to do this: goo.gl/TKqIe 12 years 38 weeks ago
  • http://t.co/q8CiVNc Dratman #drupal 12 years 38 weeks ago
Oliver Polden