
 Patrick Toole - 2006-08-20 22:07:42
The example daemon given uses:
      $fp = fopen('/tmp/daemon.log', 'a');
      fclose($fp);
      chmod('/tmp/daemon.log', 0777);
If you use a /etc/init.d statup script, the first user that writes to the log file will be root, causing subsequent logging to fail. Here is a fix:
      $fp = fopen('/tmp/daemon.log', 'a');
      fclose($fp);
      @chown('/tmp/daemon.log',$this->userID);
      @chgrp('/tmp/daemon.log',$this->groupID);
      chmod('/tmp/daemon.log', 0777);