Documentation Level: 
Intermediate
Documentation Status: 
Incomplete

PHP's default value for max_input_vars is 1000, which may be too low.

Backdrop will try to adjust PHP's max_input_vars setting automatically through a setting in it's default .htaccess file. If Backdrop is not able to make this change automatically, you may need to change it yourself.

When this value is set too low, PHP's max_input_vars setting can cause silent failures on large forms. This problem is known to commonly happen if:

  • you have more than 3 user roles, and a lot of modules (when updating permissions)
  • you have a lot of user roles (when updating permissions)
  • you have a lot of taxonomy terms in one vocabulary (when reordering terms)
  • you have a lot of menu links in one menu (when reordering menu links)
  • you have a lot of fields on a node (when saving the node)
  • you have a lot of values in a multi-value or paragraphs field (when saving the node)

Trivia: Why 10007 you ask? A value such as 10000 may be a common number used elsewhere in code. By setting it to 10007, you can easily search for it, to locate where the setting needs to be updated.

How to set the value in php.ini

If you have access to the php.ini file on your server, you can set the max_input_vars value, as follows:

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 10007

How to set the value in .htaccess

  • Find your project's .htaccess file
  • Open it, and add the following line

    php_value max_input_vars 1000
  • Change the 1000 value to 10007.
  • Save the file.
  • No restart is required

How to set the value in httpd.conf

  • Locate the httpd.conf file within the apache configuration folder (usually under /conf subdirectory.
  • Open it, and go to the end of the file. Add the code below*

    <IfModule mod_php7.c>
    php_value max_input_vars 10007
    </IfModule>

    * You may need to change mod_php7.c to match your version of PHP. Use mod_php5.c for PHP 5, for example.
  • Save the file.
  • Restart Apache and the configuration will be applied.

Note: you cannot set this value in settings.php

Some php configuration settings can be set in your site's settings.php file. Unfortunately, max_input_vars is not one of them.

You can't override it here because it is in the PHP_INI_PERDIR group. Configuration settings in this group can only be set in php.ini, .htaccess, httpd.conf or .user.ini.

See The PHP documentation on all PHP_INI_* modes.