Results 1 to 2 of 2

Thread: PHP suddenly stops before it's done

  1. #1
    Member
    Join Date
    Apr 2003
    Posts
    479

    Default PHP suddenly stops before it's done

    Running PHP 5.3.2 (cli) (built: Apr 30 2010 07:29:33)
    Using suPHP.
    REDHAT Enterprise 5.5 i686 standard

    I have a particular PHP script (uses the Smarty template engine) which has a problem: after running a bunch of PHP code, it dies without warning. Putting trace echos in the code seems to fix the problem by holding off the exiting, however.

    If nothing is output before the death occurs, it gives a premature end of script headers / 500 Internal Server Error.

    For example:

    Code:
    doSomething1();
    doSomething2();
    doSomething3();  // quits here!
    doSomething4();
    doSomething5();

    Code:
    doSomething1();
    echo " 1 ";
    doSomething2();
    echo " 2 ";
    doSomething3();
    doSomething4();// quits here!
    doSomething5();
    Code:
    doSomething1();
    echo " 1 ";
    doSomething2();
    echo " 2 ";
    doSomething3();
    echo " 3 ";
    doSomething4();
    echo " 4 ";
    doSomething5();// quits here!
    So, I am able to fix the problem by adding "echo ' n ';" every 50 lines or so. But if I do not, it stops in the middle of output.

    So it's as if PHP exits if nothing's been output for x clock cycles.

    I have tried to modify PHP's max execution time (set_time_limit), memory limit, all with no effect.

    There is no error output by PHP when it dies (even using E_ALL).

    Seems to be limited to this one script, though much longer than most (903LOC).

    It doesn't seem to be segfaulting, as there is no core file generated.

  2. #2
    Member
    Join Date
    Apr 2003
    Posts
    479

    Default

    Solved? I was able to stop the problem by turning on output buffering. Still not an explanation for what is happening, but at least it's a workaround.

Similar Threads

  1. setup stops
    By Parsisoft in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 01-05-2009, 03:25 PM
  2. Downloading just stops.........
    By bartmatusiak in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 11-26-2006, 04:42 PM
  3. PHP stops working on new accounts
    By jovisa737590 in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 05-28-2006, 10:28 PM
  4. Replies: 0
    Last Post: 06-30-2003, 12:58 PM
  5. ./upcp stops
    By ho247 in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 10-05-2002, 11:03 PM