POST Variables Crashing Page

We have a form on our production site that can generate up to thousands of check boxes. When selecting them all and submitting the form, the page crashes.

What’s weird is my dev version of the site, served with WAMP, submits the form just fine.

Both ini files have post_max_size set to the default of 8M. I’ve even upped our production ini file to 20M with no effect.

The prod server is running PHP 5.2.17 and my dev server is running 5.3, so neither have access to the new max_input_vars config setting.

Our production site is ran over an HTTPS connection, if it’s possible that could have some effect.

Hmm; it depends on the stats of your server vs your local one. Your local one will probably much faster since it’s doing over the local connection and isn’t bogged down by other requests.

But a solution could be to do a staggered submit; perhaps create some javascript to submit say a couple hundred checkboxes at a time, and show the progress to the user as it’s happening.

A couple of thousand check boxes !!!

So whats generating these check boxes and what is the data and how is the data field set up? Are you sending a very long stream to one variable?

Production is not the same as deployment server and whilst you may have something running fine on a 5.2 branch, 5.3 has changes to it and this may be whats causing the problem. I was annoyed that they dropped SQLite2 from PHP and offered no legacy option in SQLite3 which has likely left millions of users whose sites use SQLite2 and with the host upgrading to 5.3, many a site is now stuffed…

Anyway, in my opinion your issue is because of 5.3, do you have the option to roll back to a previous version on the deployment server? Rule out that its a PHP issue or not.

The option you have is to install a webserver, PHP5.3 and try it locally with 5.3.

Despite not being introduced until later versions of PHP 5.3, I read several reports saying to go ahead and include the max_input_vars directive in my 5.2.17 php.ini file.

Additionally, I found we were using a Suhosin security patch, which wasn’t immediately obvious because we are using a FreeBSD server. FreeBSD doesn’t require any Suhosin directives in the php.ini file as do other servers.

After including the following directives in my ini file, everything is now working:

[suhosin]
suhosin.request.max_vars = 20000
suhosin.post.max_vars = 20000

max_input_vars  = 20000

Snark aside, find another way. You should never need hundreds, let alone thousands, of checkboxes.