PHP Deamon

Posted by on Oct 5, 2012 in PHP Programming | No Comments

Not every problem can be solved with an aid of a cronjob. Sometimes a real time background process is required. The most common approach is to create an ordinary script and run it from command line with “&” character at the end.

I’m sure many PHP programmers asked themselves a question, is that the right way of doing it? What is the correct way? We usually don’t deal with the low level programming, but the C programmers do. I found the answer in the Advance Programming in the UNIX Environment book. There is a chapter about creating a deamon in C. It let me to create the below library which can be included into any PHP deamon script.


And a small example of how to use the library.

Leave a Reply