[lug] Running a PHP script as a daemon

Bamm Visscher bamm.visscher at gmail.com
Wed May 17 12:17:29 MDT 2006


I can't say I've done PHP but I assume it offers some type of fork().
The common way to daemonize an app in any language is to fork a child
and the have the parent exit cleanly afterwards.

Bammkkkk


On 5/17/06, Jason Vallery <jason at vallery.net> wrote:
> Hi all,
>
> I've done some googling on this topic and I have come up short, I thought I
> would throw it out here.  I have a php script that essentially connects a
> socket to a remote server and listens, when it receives data (XML) it
> processes it and stores it in the database.  Since this script needs to run
> all the time, what is the best way to handle that?  I'd like a solution that
> I can setup to start on system boot, and restart if for some reason PHP
> encounters a critical error and crashes (connection drop for example).
>
> The server is running CentOS 4.3 and  PHP 5.0.4.
>
> Thoughts?
>
> Thanks
> -Jason
>
>
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List:
> http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
>


-- 
sguil - The Analyst Console for NSM
http://sguil.sf.net



More information about the LUG mailing list