Drupal, AJAX, PHP and max_input_vars

Published on Author JFLeave a comment

While developing a fairly list heavy website using Drupal 7 we reached a point where the common AJAX interface was breaking with an unknown error. The error suggested it was the AJAX function itself that it was breaking.

Foolishly, we spent untold hours trying different version of JQUERY and looking into client side code to solve the problem instead of doing what you should do: check the PHP logs.

We found this:

[Thu Apr 30 20:11:14 2015] [error] [client 111.222.333.444] PHP Warning:  Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http://[websitename].com/node/3193/edit

A little research and we discovered that this PHP configuration variable has been in PHP since 5.3.5: max_input_vars 

It prevents a DOS attack by sending unlimited post variables.

The default value is 1000.

The variable is not in php.ini . You need to manually add it to modify the value.

I added it to php.ini (you can set it elsewhere for your particular hosting configuration) as max_input_vars = 2000 (after trying 1500 and other numbers) and the AJAX error went away.

Hope this helps someone along the way….

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.