tags:

views:

147

answers:

2

Hi,

I need to start a PHP script via Apache - which will basically continue to run - it will be used for a small instant messaging widget - so it must continually run to update other users on new messages. What timeout features or other barriers should I be weary of in Apache? Will some feature of Apache not allow me to run a PHP process continually?

+3  A: 

set_time_limit will help you.

Nicolas
+5  A: 

Based on your context (instant messaging widget), you probably do not want to keep the PHP script running because:

  1. anything on the page after the widget will not be loaded;
  2. you will have to flush the output, otherwise user will not be able to see anything.

There are many other ways to implement instant messaging, like AJAX. I suggest you do a search on this topic.

Update: I have recently come to the realization that there is a particular name for this type of web application model, which may be a better reference than simply stating "AJAX". It's called Comet (wikipedia link).

Bill Yang