Changing the max allowed POST variables

I have a large form that is generated from a CSV input file. Generally these files are small CSV files with 20 or 30 records, this generates a nice form without too many input fields.

However if you try to import a CSV file with thousands of records the generated form will have thousands of input fields. When you submit this form to the server not all these fields will get sent to the server.

The php configuration max_input_vars is generally set to 1000, so any fields after 1000 will be dropped, causing all sorts of issues.

The fix is to put this line of code in your .htaccess file:

php_value max_input_vars 10000

If this doesn’t work check the output of phpinfo(); The server might have suhousin or similar installed and they have their own set of variables that need to be changed (some cannot be changed in .htaccess). See here for more information:

http://webmasters.stackexchange.com/questions/29813/how-to-set-suhosin-post-max-vars-in-a-htaccess-file

or here:

Try this in .htaccess:

php_value suhosin.perdir pr
php_value suhosin.post.max_array_depth 100
php_value suhosin.post.max_array_index_length 128
php_value suhosin.post.max_name_length 128
php_value suhosin.post.max_value_length 2000000
php_value suhosin.post.max_totalname_length 512
php_value suhosin.post.max_vars 10000
php_value suhosin.request.max_array_depth 100
php_value suhosin.request.max_array_index_length 10001
php_value suhosin.request.max_name_length 128
php_value suhosin.request.max_value_length  2000000
php_value suhosin.request.max_totalname_length 512
php_value suhosin.request.max_vars 10000

 

1 thought on “Changing the max allowed POST variables

  1. Zurd

    Thanks! I was able to defeat the evil maximum limit of Magento custom options with max_input_vars! Around 140 is not enough, needed moar!

    Reply

Leave a Reply to Zurd Cancel reply

Your email address will not be published. Required fields are marked *