Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I PREVENT TIMEOUT ? 1

Status
Not open for further replies.

ruffy

Programmer
Oct 1, 2003
72
US
Running on my own computer/server, I'm running into the problem of timing out.

I've tried set_time_limit(999999999) and have similarly updated the PHP.INI file - but the system seems to ignore these limits.

Looking for a helpful idea. Thanks.
 
Intresting the wording does say run out of safe mode OR change the value in php.ini. I wonder if your number is just too big, it's about 1900 years !. Just try a qute big number like 3600 to get it to run for an hour, or set it to 0 which is infinite.
 
Have you looked at the web servers timeout setting? It could as well be the culprit.
 
Setting to 0 also conked out with "CGI Timeout". I changed in my Win 2000 box the "Connection Timeout" from 900 secs to 9900 secs, although this figure deals with an inactive user situation, whereas I make sure I'm spitting out output to the browser to forestall the server from thinking my app is inactive.
 
Well Connection Timeout has nothing to do with my continuing timeouts. I raised the timeout integer to billions and nothing doing! There MUST be a way to get the thing to process till I'm done. And I'm only 1/3 done by the time I timeout!
 
It doesn't really matter; I'd say it should take 10 minutes. I'm creating an array. As it gets bigger and bigger, the seek to discover if the next element I wish to add to the array is in the array already - also takes longer and longer. I'm creating a "dictionary" of unique words found in a few volumes of literature.

I've perused the internet and found many such dilemmas but not yet found the CURE!

Any help would be appreciated.
 
What I'm getting at is how long does it actually run for before it times out. I wonder if your actual code is doing odd stuff to the PHP run time, if your adding and adding to an array you might be giving the memory managment elements a run for thier money !
 
Sorry shoud have said on the run time, does it for example always stop after 103 seconds for example
 
using the following will be succesfull providing your box is setup to allow it:
Code:
<?
set_time_limit(0);
while (true) {
  echo ".";
  sleep(1);
}
?>

--BB
 
I don't get it. I don't want the program to sleep. I want it to go ahead and process.

As to the period of time before it conks out, it's about 7 minutes or so. I only know what key it's on when it dies, which is about 1/3 of the way through the array. It'll vary somewhat.
 
Ok,

We now know it runs for about 7 seconds,
Is this in the browser ?, does it give an error message ?,
Can you try running it from the command prompt, you often get some more diagnostics given which can get lost in the browser, for example it is not running within a web server.
I'm convinced something is going wrong in your code!, if you have set the limit to 0, it should go on forever.
 
Good idea; I tried running the app via IE6 and Firefox.
They both gave roughly the same output before giving me this error:

"key HTTP/1.1 502 Gateway Error Server: Microsoft-IIS/5.0 Date: Mon, 21 Jun 2004 16:42:15 GMT Connection: close Content-Length: 186 Content-Type: text/html
CGI Timeout
The specified CGI application exceeded the allowed time for processing. The server has deleted the process."

I also tried giving the app more memory to play with
memory_limit = 20M
but that only slowed the other processes running at the time.

Still at my wits' end.
 
Rather than trying to run the script from the browser, create a "launcher" script which schedules a "processor" script to run immediately under the scheduler service (or at daemon, whichever is appropriate) using the "at" command.

The processor script can then do its business undisturbed by web timeouts and send you an email when it's done.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks sleipnir214. It's just that I have no idea how to create a launcher script, nor a processor script, nor have I ever used WIN 2000's scheduler service for that matter.

Could you help me out here?

By the way - ingresman - it's about 7 mins not secs. I watched the task manager while the app was running and it looks like the app was given 4 minutes of CPU time.
 
Sleipnir214 - I now see how to schedule a task.
ControlPanel -> ScheduledTasks -> Add ->
but here I'm stuck because I don't know what "program" to select to run.
 
Your "launcher" simply schedules the other script using the Win32 "at" command -- it lauches the other script. Issuing "at /?" at a command prompt or searching the Win32 help system can tell you lots about that command. From your launcher script, you'll use either exec() or the backtick operator to invoke "at".

And you've already written your "processor" script -- it's the script you can't get to run to completion. Strip off any output code lines, add an invocation of mail(), and you're there.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top