Skip to content
Advertisement

Why is max_input_vars ignored?

I have max_input_vars set to 10000 in .htaccess. ini_get('max_input_vars') correctly returns 10000 and phpinfo correctly shows the local value of max_input_vars to be 10,000 (with a master value of 1,000) and yet a sample script on a GoDaddy shared server with anything more than 1,000 <input type="hidden" name="input[]" value="n"> fields only populates $_POST['input'] with 1,001 elements, whereas when run on my local machine it works correctly. Both are running PHP 7.2 and both have post_max_size 100M.

Is there some server setting that means the local value of max_input_vars is ignored?

The script I’m using to test this is below. You enter the number of hidden input fields to create, click the “Create inputs” button, and then submit.

JavaScript

Before submitting form (on both local machine and remote server):

Before submitting form

After submitting form on local machine:

After submitting form on local machine

After submitting form on remote server:

After submitting form on remote server

Advertisement

Answer

After some testing I was able to get it working by setting max_input_vars=10000 in a .user.ini file in the document root. I suspect that cPanel was filtering the input before the rule in .htaccess was applied.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement