[PHP] Re: Running php in background?

2002-01-07 Thread LaserJetter

I had Apache running on Win98 and doing a pretty demanding job (well, for a
350MHz K2) and it slowed the machine down noticeably.
If the PHP script timed out the computer came back to like but if i closed
the browser window or clicked stop it seemed to keep doing it.
Maybe MySQL is finishing off the query it was last given until it terminates
or whatever. If a big, complex query was sent through lots of records this
one quesry could take a long time to sort out

LJ


James Hudnall [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wrote a php program that has to do a lot of processing on a couple large
mySQL tables that can take hours, so often the page will time out or kick
back a
 cannot find server errir. But it seems by checking the DB that records are
still being updated. IS it possible the job runs in background even though
it fails to
 delive the final results in the browser? I don't need the final results,
it just says when the job is completed.

 Ideally, I would like to run the job in the background anyway. Can that be
done?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Running php in background?

2002-01-07 Thread J Smith


For this sort of thing, it may be easier to run the job from a shell. Try 
compiling php as the CGI/CLI executable. Then you can run your scripts 
like, say, a Perl script or whatever. Just add the ampersand at the end of 
the command to run it in the background. (I'm assuming a UNIX-like system 
with some sort of sh/bash-like shell.) Also remember to set the timeout to 
0 at the beginning of the script using 

set_time_limit(0);

You might also want to surpress output to stdout for background jobs, which 
is generally preferable for UNIX background processes.

If you still want to do it via the browser, just use set_time_limit(0). 
Even if you hit stop or the connection is broken, I think the script will 
still execute, unless you've registered a shutdown function, but I'm not 
100% positive on that one.

J


James Hudnall wrote:

 I wrote a php program that has to do a lot of processing on a couple large
 mySQL tables that can take hours, so often the page will time out or kick
 back a cannot find server errir. But it seems by checking the DB that
 records are still being updated. IS it possible the job runs in background
 even though it fails to delive the final results in the browser? I don't
 need the final results, it just says when the job is completed.
 
 Ideally, I would like to run the job in the background anyway. Can that be
 done?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]