title: Listing all running processes on server using PHP
body: <p>I am trying to get a list of all processes currently running on my Ubuntu server using <code>PHP</code>. Ideally, I would like to get the following information:</p>
  
  <ul>
  <li>The Process ID</li>
  <li>The Command Used to Execute the Process</li>
  <li>The Arguments Given to the Process</li>
  </ul>
  
  <p>I know that I can use <code>exec</code> to call <code>ps</code> to list the currently running processes.</p>
  
  <pre><code>exec('ps aux', $output);
  </code></pre>
  
  <p>However, the output is formatted with arbitrary number of spaces, so parsing it is not the easiest thing in the world.</p>
  
  <p>I could potentially use <code>explode</code> or <code>preg_split</code> to parse, but <strong>is there an easier way to get a list of all running processes using <code>php</code>, along with the process id, command, and arguments?</strong></p>