Skip to content

Setting the max_input_vars directive in .htaccess

The max_input_vars directive in PHP controls the maximum number of input variables a script can process. 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 data loss.

  • Prevents errors when submitting forms with more than 1000 fields.

  • Ensures CMS platforms can save large configuration arrays.

  • Avoids warnings like:

    Warning: Input variables exceeded 1000.
    To increase the limit change max_input_vars in php.ini.
  • Log in to cPanel or use FTP/File Manager.
  • Navigate to your site’s root directory (e.g., /public_html).
  1. If .htaccess already exists, open it for editing.
  2. If not, create a new file named .htaccess.

Insert the following line:

php_value max_input_vars 2000
  • Replace 2000 with the desired number of input variables.
  • Use values like 1500, 2000, or higher depending on your application’s needs.
  1. Save the .htaccess file.
  2. Create a test file info.php with:
  3. <?php phpinfo(); ?>
    Load it in your browser and search for max_input_vars.
  4. Confirm the new value is active.
  5. Delete the test 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.