title: PHP exec command using pgrep return value incorrect
body: <p>I have a php script with the following command I am running:</p>
  
  <pre><code>exec("pgrep -fl ./build-dh", $output, $return);
  </code></pre>
  
  <p>pgrep usually returns "1" if it does not find a "./build-dh" process running, however, it is always returning "0", even when I am positive the process is not running.</p>
  
  <p>Here is what I get from $output:</p>
  
  <pre><code>Array ( [0] =&gt; 28560 sh -c pgrep -fl ./build-dh )
  </code></pre>
  
  <p>This means that it is outputting its' own pid, which I guess forces a "0" return code no matter what.  When I run the following in the shell, it works fine:</p>
  
  <pre><code>$pgrep -fl ./build-dh
  $echo $?
  1
  </code></pre>
  
  <p>So the return value works fine... and when I run this:</p>
  
  <pre><code> $pgrep -f nginx
  11192
  11193
  11194
  11195
  11196
  $echo $?
  0
  </code></pre>
  
  <p>How can I get this working correctly in PHP?</p>
  
  <p>Thanks</p>