Skip to content

Changing the max_input_vars directive in PHP scripts

The max_input_vars directive in PHP controls the maximum number of input variables your script can handle. By default, this value is set to 1000. If your application (such as WordPress, Joomla, or a custom CMS) uses large forms or complex data structures, you may need to increase this limit to avoid errors like:

Warning: Unknown: Input variables exceeded 1000.
To increase the limit change max_input_vars in php.ini.
  • Large forms with many fields (e.g., product catalogs, survey forms).
  • Complex CMS configurations with nested arrays.
  • Prevents data loss when submitting forms with more than 1000 fields.

Create or edit a php.ini file in your application directory:

max_input_vars = 1500

If your hosting environment supports .user.ini files:

max_input_vars = 1500

Place this file in the root directory of your application.

On Apache servers, you can override the directive in .htaccess:

php_value max_input_vars 1500
  1. Log in to cPanel.
  2. Go to Software → Select PHP Version → Options tab.
  3. Locate max_input_vars.
  4. Increase the value (e.g., 1500 or 2000).
  5. Save changes.
  • Create a test file info.php with:

    <?php phpinfo(); ?>
  • Visit http://yourdomain.com/info.php.

  • Search for max_input_vars in the output to confirm the new value.

  • Delete the file afterward for security.

  • Increase gradually (e.g., 1500 → 2000) instead of setting excessively high values.
  • Monitor memory usage, as higher limits can increase resource consumption.
  • Always test form submissions after making changes.