Jump to content

Premature end of script headers error


Thatar

Recommended Posts

Hello guys,

 

I had made a nice little script, and suddenly out of nowhere came this stupid "Premature end of script headers"error.

This is how it looks like in the log:

[Tue Apr 20 00:02:50 2010] [warn] mod_fcgid: read data timeout in 40 seconds
[Tue Apr 20 00:02:50 2010] [error] [client xx.xxx.xx.xx] Premature end of script headers: buyunit.php, referer: http://www.omnicash.org/cycler/ 

 

When you saw this topic you probably thought, Google it! Well I did, and all the things I found say something about having your server set up the wrong way, which is not the case since it only happens on a certain action. Strangely enough the following if-statement seems to be causing the error (even though I can't see anything wrong about it):

if($result <= 0)
               {
                   //Make the negative of $result the new $flow
                   $flow -= $req;
                   //Cycle complete, add one to $topid
                   $topid += 1;
                   //Cycle complete, $done = 1
                   $done = 1;
                   //Required profit must be added to balance of account
                   $addCyclerBalance = $req;
                   //Requirements have been met, $req = 0
                   $req = 0;
                }

 

The whole code is attached to this message, I hope you can do something with it. I just don't have a clue. :confused: If you need more information please tell me.

 

Thanks in advance, Herman

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/199071-premature-end-of-script-headers-error/
Share on other sites

Chances are your script is timing out, this is not uncommon, especially when you do multiple whiles inside whiles with updating data in a database. You should try and make your script a bit more efficient and try to move the queries outside of the loop and minimize them if possible.

 

To avoid the issue you can try increasing the timeout with the set_time_limit  0 = never timeout. Default is 30 seconds. It goes by seconds btw.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.