PHP max_input_vars configuration explained

The PHP max_input_vars configuration is used to limit the maximum number of input variables your server can use to run a function.

Input variables are GET/POST/COOKIE variables.

This configuration was introduced as a security measure to avoid overloading the server when running a PHP script.

Increase max_input_vars using directives

The default value of max_input_vars is 1000. You can change this value by setting the max_input_vars directive in the php.ini file.

For example, here’s how to increase the maximum input variables to 5000:

max_input_vars = 5000

You can also set the directive in the .htaccess file as follows:

php_value max_input_vars 5000

Or you can set the directive in the wp-config.php file:

@ini_set("max_input_vars", 5000);

Finally, you can also change the max_input_vars value from cPanel.

Increase max_input_vars from cPanel

To increase the max_input_vars value in cPanel, you need to log into the cPanel system first.

Inside the cPanel, you need to find the MultiPHP INI Editor menu located in the Software tab:

Next, select the domain that you want to change to open the corresponding PHP config.

You should see the max_input_vars directive on the list as shown below:

Some WordPress themes usually need the value set to 3000 or 5000 to run properly. You need to adjust the value above accordingly.

When the script has more input variables than specified in the directive, an E_WARNING message will be sent from PHP and excess variables are truncated.

The message will be similar as follows:

Input variables exceeded 1000.
To increase the limit change max_input_vars in php.ini.

For a WordPress theme, you may experience data loss and incomplete UI rendered on the front end.

Sometimes, you may not have access to the directive files and you don’t see the MultiPHP INI Editor in your cPanel menu.

When that happens, you need to contact your hosting provider and ask them how to change the max_input_vars value.

Now you’ve learned what the max_input_vars is and how to increase the value. Nice work! 👍

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.