Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.