The max_input_vars setting in PHP controls the maximum number of input variables (e.g., GET, POST, or COOKIE variables) that PHP can handle in a single request. In Bitrix, a low max_input_vars value can cause issues with large forms, settings pages, or when saving configurations, especially in admin panels.

Common Errors Caused by Low max_input_vars

  1. Form Submission Issues:
    • Some fields may not save, or partial data is submitted.
    • Example error: "Data is missing or incomplete."
  2. Admin Panel or Module Issues:
    • Errors when saving settings with many fields.
  3. Menu and Permission Settings:
    • Long menus or permissions configurations fail to save.

Default Value of max_input_vars

  • Default value: 1000
  • This is often insufficient for Bitrix installations with complex configurations.
  • Recommended value: 5000 or higher.
  • For very large forms or configurations, you may need to increase it further.

How to Adjust max_input_vars

Update php.ini

  1. Locate your PHP configuration file:
    php --ini
  2. Open php.ini for editing:
    sudo nano /etc/php/7.x/apache2/php.ini
  3. Increase the max_input_vars value:
    max_input_vars = 5000
  4. Restart the web server:
    sudo systemctl restart apache2

    or

    sudo systemctl restart php7.x-fpm

Update .htaccess (If You Cannot Edit php.ini)

  1. Open the .htaccess file in your website root directory.
  2. Add the following line:
    php_value max_input_vars 5000

Update user.ini (If .htaccess Does Not Work)

  1. Create or edit a .user.ini file in your website root directory.
  2. Add the following line:
    max_input_vars = 5000
  3. Restart PHP:
    sudo systemctl restart php7.x-fpm

Use ISPmanager or cPanel

If your server is managed via a control panel like ISPmanager or cPanel:

  1. Go to PHP Settings or PHP Selector.
  2. Find max_input_vars and increase it to 5000.
  3. Save and restart PHP from the panel.

Verify the Change

  1. Create a phpinfo.php file in your root directory:
    <?php
    phpinfo();
    ?>
  2. Open it in your browser:
    http://yourdomain.com/phpinfo.php
  3. Look for max_input_vars in the output to confirm the new value.

Troubleshooting

Issue Solution
Changes not applied Ensure you are editing the correct php.ini or .htaccess file.
Bitrix still shows errors Double-check the new value in phpinfo() output.
Large forms still fail Increase the value further (e.g., max_input_vars = 10000).
Multiple PHP versions on server Update php.ini for the correct PHP version.
  • The max_input_vars setting is crucial for Bitrix to handle large forms and configurations.
  • Set the value to 5000 or higher to avoid errors.
  • Use php.ini, .htaccess, or control panel tools to adjust the value.