How to increase Max Input Vars?

Since PHP 5.3.9 a new php.ini option was added called max_input_vars. It is part of the run-time configuration and in most cases this won’t be a problem. But some users have found that when they are saving large amounts of data, nothing happens.

Upon enabling Display errors they find this is being outputted each time they hit the save button.

Warning: parse_str() [function.parse-str]: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in/home/user/public_html/path/t0/file/causing/this/error.php on line 459

What is Max Input Vars?

It limits the number of input variables, this limit affects $_GET, $_POST and $_COOKIE superglobal separately.

What would be affect by this limit?

The main item to be affected would be forms, and they can come in many forms ( no pun intended).

  • Large Forms (such as a survey form, or a detailed contact form)
  • Option Forms, such as a theme or plugin options page.

What is the purpose of Max Input Vars?

The main purpose of Max Input Vars is to help mitigate the possibility of denial of service attacks which use hash collisions.

How can we Increase Max Input Vars?

The default value is set to 1000

In some cases we may need to raise this or we will be unable to save our data.

To increase this value you will need to edit your php.ini file usually located in /usr/local/lib

Note – as far as I am aware shared hosts will not allow you to edit this value, even if you have a local php.ini file located in your public_html folder.

In that case you will either have to

  • Move to a VPS or Dedicated server
  • Reduce the total number of input variables
  • Revert your PHP back to a pre 5.3.9 version

If you have a VPS or dedicated server, you can either ask your host to increase the value for you, don’t go crazy with it, 3000 should be a good number, as it is there for a reason.

If you are comfortable with editing php.ini then you can login with SSH or SFTP and located you php.ini file and add the following.

max_input_vars = 3000 = 3000
suhosin.request.max_vars = 3000

I would first search for max_input_vars to see if it already exists, if not just add the above.

You can check to see if it working by creating a php info file.

Create a file called info.php and add the following.

<?php phpinfo(); ?>

upload it to your public_html folder.

The type

Scroll down to Core and you will see the max_input_vars and the new value should be shown like so.


Don’t forget to delete the php info file later as it contains a lot of valuable data that you may not want others to see.

[blue_note]Note: You must restart Apache in order for the changes to take affect.[/blue_note]

Meet the Author

Matthew Horne

Matthew Horne is web developer who specializes in optimized development. He also builds custom solutions instead of reverting to plugins. Matthew Has a strong understanding of PHP, JavaScript, jQuery.

5 comments… add one
  • Debbie Aug 27, 2013, 5:52 pm

    I have a very large .csv file I am trying to upload with 17k records. I am using Wordpress – latest edition. It was recommended that I set my max execution time to -1. Do I set that in both php5.ini file and the wp-config? Would love some feedback.


    • Matthew Horne Aug 30, 2013, 11:29 am

      If you have access to root on the server you can set this via the php config editor.

  • Boy Jun 5, 2014, 4:45 pm

    I’m wondering if there any limitations. my value is already set at 5000 and soon thats not enough anymore.

    Ofcourse we can increase the value again but how will that effect the system?

    Thanks in advance

  • Ugo Jun 6, 2014, 11:50 am

    after you edit the php.ini file do not forget to restart apache!

    on centOS use:
    service httpd restart

    on Ubuntu:
    service apache2 restart


Leave a Comment