title: "ps aux" output on the webpage?
body: <p>I am wondering is this safe way to put <code>ps aux</code> into array and then display on the web? Or what could be done to improve it?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;table width="900px" border="1"&gt;
      &lt;tr&gt; 
          &lt;td&gt; PID &lt;/td&gt;
          &lt;td&gt; CPU &lt;/td&gt;
          &lt;td&gt; Mem &lt;/td&gt;
          &lt;td&gt; Start &lt;/td&gt;
          &lt;td&gt; Command&lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php
      exec("ps aux | grep -v grep | grep  process.php", $psOutput);
      if (count($psOutput) &gt; 0) {
          foreach ($psOutput as $ps) {
              $ps = preg_split('/ +/', $ps);
              $pid = $ps[1];
              $cpu = $ps[2];
              $mem = $ps[3];
              $time = $ps[8];
              $command = $ps[10] . " " . $ps[11];
              echo "&lt;tr&gt;";
                echo "&lt;td&gt;" . $pid . "&lt;/td&gt;";
                echo "&lt;td&gt;" . $cpu . "&lt;/td&gt;";
                echo "&lt;td&gt;" . $mem . "&lt;/td&gt;";
                echo "&lt;td&gt;" . $time . "&lt;/td&gt;";
                echo "&lt;td&gt;" . $command . "&lt;/td&gt;";
              echo "&lt;/tr&gt;";
          }
      }
      ?&gt;
  &lt;/table&gt;
  </code></pre>