title: shell_exec - logging & outputting
body: <p>I am running multiple <code>shell_exec</code>, <code>process.php</code>'s run in the background</p>
  
  <p>On the <code>shell/ssh</code>, I execute the code like this: <code>username [~/public_html/curl]# php index.php</code></p>
  
  <p>Example....</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;?php
   shell_exec("php process.php &gt; /dev/null 2&gt;&amp;1 &amp;");
   shell_exec("php process.php &gt; /dev/null 2&gt;&amp;1 &amp;");
   shell_exec("php process.php &gt; /dev/null 2&gt;&amp;1 &amp;");
   shell_exec("php process.php &gt; /dev/null 2&gt;&amp;1 &amp;");
  ?&gt;
  </code></pre>
  
  <p><strong>process.php</strong> </p>
  
  <pre><code>&lt;?php
  $section = rand(999,999999);
  $z = 1;
  print "STARTED .... \n";
  while($z &lt;= 10) {
   print "---------------------------------\n";
   print $section . ": " . $z . "\n";
   $z++;
   sleep(2);
  }
  print "LOOP FINISH at " . time();
  ?&gt;
  </code></pre>
  
  <p>when <code>process.php</code>'s is running, I am having two problems with this:</p>
  
  <ol>
  <li>I cant not see the output from <code>process.php</code>'s (I need to know what they are doing)</li>
  <li>I need to know which process is finish and which have started.</li>
  </ol>
  
  <p>What the best way logging the output in real time? saving into text file? or how can it be done to mysql database (logs table)?</p>