SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2012
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    SitePoint Addict bronze trophy
    Join Date
    Sep 2005
    Posts
    323
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Enthusiast bronze trophy \\.\'s Avatar
    Join Date
    Oct 2013
    Location
    UK
    Posts
    72
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2012
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:
    Code:
    [suhosin]
    suhosin.request.max_vars = 20000
    suhosin.post.max_vars = 20000
    
    max_input_vars  = 20000

  5. #5
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by brandonBuster View Post
    We have a form on our production site that can generate up to thousands of check boxes.
    http://www.usabilitycounts.com/2012/...-your-company/

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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •