PHP Threads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
sakthi
Forum Newbie
Posts: 12
Joined: Wed Apr 12, 2006 1:13 am
Location: Mumbai-India
Contact:

PHP Threads

Post by sakthi »

hi everybody,

i created a script that works as a E-mail listener. it will receives the e-mails and process on it.
Then it will generate some reply e-mail notifications. Then it will send those replies to the end user.

Now it will work when i request that script from the browser.(i.e, 127.0.0.1/email_listener.php).

but i want to do it by a thread work. means that, it should work from the server automatically, whenever the server starts it should start and should work as listener.

i think it can be achieved by some thread concept. is it there in PHP?

could you please help me?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

while there is forking in PHP... it would be much easier to use cron
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

why not start it from inetd?
User avatar
sakthi
Forum Newbie
Posts: 12
Joined: Wed Apr 12, 2006 1:13 am
Location: Mumbai-India
Contact:

Post by sakthi »

hi, thanks a lot.

i can execute the script timely using the cron.

i want to run the script forever. how it is possible?

if i set minutes field 1 - 59, will it work? :cry:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If it's running forever you effectively have a hung process. Just stick with cron.
Post Reply