title: System_Daemon failed to open stream /var/log/mydaemonname.log
body: <p>I'm trying to run this simple daemon by cli</p>
  
  <pre><code>function doTask(){
  
      echo 'mytest';
  }
  // Include PEAR's Daemon Class
  require_once "/usr/share/php/System/Daemon.php";
  
  // Bare minimum setup
  System_Daemon::setOption("appName", "mydaemonname2");
  
  try{
  // Spawn Deamon!
  System_Daemon::start();
  
  // Your PHP Here!
  while (true) {
      doTask();
  }
  
  // Stop daemon!
  System_Daemon::stop();
  }
  catch (Exception $e) {
      echo 'Caught exception: ',  $e-&gt;getMessage(), "\n";
  }
  
  
  
  notice: Starting mydaemonname daemon, output in: '/var/log/mydaemonname.log'
  [Feb 08 12:17:23]  warning: [PHP Error] file_put_contents(/var/log/mydaemonname.log): failed to open stream: Permission denied 
  </code></pre>
  
  <p>both in my local host and in my dev server.</p>
  
  <p>If I try to roughly create and set chmod 777  file permission to /var/log/mydaemonname.log
  I get this other error</p>
  
  <pre><code>[Feb 08 12:30:31]   notice: Starting mydaemonname daemon, output in: '/var/log/mydaemonname.log'
  [Feb 08 12:30:31]      err: Unable to create directory: '/var/run/mydaemonname' [l:1366]
  [Feb 08 12:30:31]    emerg: Unable to write pid file /var/run/mydaemonname/mydaemonname.pid [l:1272]
  [Feb 08 12:30:31]     info: Process was not daemonized yet, just halting current process
  </code></pre>
  
  <p>and if I try to set 777 file permission to /var/run/mydaemonname I get this in the log file</p>
  
  <pre><code> notice: Starting mydaemonname daemon, output in: '/var/log/mydaemonname.log'
  [Feb 08 12:17:06]      err: Unable to change group of file '/var/run/mydaemonname/mydaemonname.pid' to 0 [l:1425]
  [Feb 08 12:17:06]     crit: Unable to change identity [l:1281]
  [Feb 08 12:17:06]    emerg: Cannot continue after this [l:1283]
  </code></pre>
  
  <p>Can you help me, please ?</p>
  
  <p>Bye</p>