The short version: use
var_dump, don’t use
Writing a daemon in PHP can be a very attractive prospect. You already have your website written, so you have all of this great code already. You just need it to run and keep track of some data or handle some data as it comes in by polling a database. All you do is.. make some infinite loop and..
One of the flaws with PHP is the ways in which it handles engine errors. However, might change in PHP 5.6.