-

Note: You are currently viewing documentation for Moodle 3.10. Up-to-date documentation for the latest stable version of Moodle may be available here: Environment - max input vars.

Environment - max input vars

From MoodleDocs
Revision as of 15:30, 13 May 2021 by German Valero (talk | contribs) (Copied from 3.11 page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The PHP setting max_input_vars determines how many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). 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.

There are a lot of big or potentially big forms in Moodle, such as:

  • Site administration tree search
  • Editing roles
  • Grading courses with big number of participants
  • Large quizzes and quiz settings

The default value for max_input_vars in PHP is 1000, this is not enough for many cases.

If you are using PHP 7 the recommended value for the max_input_vars in Moodle is 5000 but you can still use Moodle with the lower value. Moodle code has a workaround that allows to submit the forms even with bigger limit however this workaround is not perfect. It is much better to increase the setting.

If you are using PHP 8 the minimum value of 5000 is required. By default PHP 8 sets to display startup errors (see [[1]]). This means that the warning about exceeding max_input_vars appears before the workaround even applied.

To change max_input_vars you can either set it in php.ini or modify it in runtime, for example for Apache you can create .htaccess file: php_value max_input_vars 5000