Thursday, March 24, 2011

What generally causes PHP to encounter a stack overflow?

I am on a windows IIS server serving some php sites. We have moved a working PHP site on to our server, however submitting one of the forms returns:

PHP has encountered a Stack overflow

When commenting out the MYSQL INSERT and assigning SESSION variables the form processes, however these are vital segments of the submission form.

Any help would be greatly appreciated.

From stackoverflow
  • Too much recursion?

    Greg Hewgill : See http://stackoverflow.com/questions/466884/what-generally-causes-php-to-encounter-a-stack-overflow#466901
    troelskn : Argh ... you've stack overflow'et stack overflow ... that's like a recursive recursion ...
    Evan Fosmark : Haha, nice one Greg.
    tj111 : I just accidentally this whole post.
    Crescent Fresh : @Greg: I wish we could upvote comments.
  • For me it's usually an infinite loop (including infinite recursion)

  • Which version of php are you using? In some older versions, an infinite (or very deep) recursion would cause a stack overflow, if I remember correctly. Today you would get a more specific error message ("Maximum function nesting level of '100' reached, aborting!").

    You mention sessions as a possible cause; Are you storing complex data structures in session? Sessions are serialized and unserialized between requests, which probably could cause some problems if you put too much stuff in them (Not sure how much is too much though). Maybe you could reduce on that?

  • [off-topic]

    $stackoverflow = file_get_contents('http://stackoverflow.com/tags/php');
    // voila, php encountered stackoverflow ^-^
    

0 comments:

Post a Comment