How long should a php process run

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
quocbao
Forum Commoner
Posts: 59
Joined: Sat Feb 04, 2006 2:03 am
Location: HCM,Vietnam
Contact:

How long should a php process run

Post by quocbao »

Hi , i just wondering how long should a php process run ?

For example : in a php script i use ignore_user_abort , set_time_limit(0) , this means this process may last forever , but it will stop , and my question is how long should it run ?

(sorry for my bad english , and i don't know where to post this question :) )
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: How long should a php process run

Post by Chris Corbyn »

quocbao wrote:Hi , i just wondering how long should a php process run ?

For example : in a php script i use ignore_user_abort , set_time_limit(0) , this means this process may last forever , but it will stop , and my question is how long should it run ?

(sorry for my bad english , and i don't know where to post this question :) )
That really depends upon what you're doing.

I mean, you can write entire services in PHP. They'd want to run forever. Running PHP from command line can run as long as you like until the process is aborted manually. Even with set_time_limit(0) in a web page your script will still stop when Apache times out. ignore_user_abort() is a different situation though.

Basically.... it depends why you're asking? :)
User avatar
quocbao
Forum Commoner
Posts: 59
Joined: Sat Feb 04, 2006 2:03 am
Location: HCM,Vietnam
Contact:

Post by quocbao »

Even with set_time_limit(0) in a web page your script will still stop when Apache times out
I didn't notice about apache timeout :( , then there might be some problems.
I want to ask this question because i have a small script to send mail ( about 2 thousands :( ) . Yeah , i know there's another solution , but i still want to know clearly about this .
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

quocbao wrote:
Even with set_time_limit(0) in a web page your script will still stop when Apache times out
I didn't notice about apache timeout :( , then there might be some problems.
I want to ask this question because i have a small script to send mail ( about 2 thousands :( ) . Yeah , i know there's another solution , but i still want to know clearly about this .
Don't try to send 2000 mails in one go is the upshot of it ;) Batch them max 100 at a time.
Post Reply