What is the best way to keep a PHP script running as a daemon, and what\'s the best way to check if needs restarting.
I have some scripts that need to run 24/7 and f
I agree that PHP is not the best tool for this, however I can understand why you want to use PHP so you can reuse components from your application such as database access, and so on.
I had a similar problem and I ended up developing The Fat Controller which is a daemon written in C that can run PHP scripts. It can also run as a multithreaded daemon, running many instances of a script in parallel.
There's more information and use cases here: http://www.4pmp.com/fatcontroller/