title: PHP shell tar problem, return code 2
body: <p>Want to archive a folder using tar from PHP:</p>
  
  <pre><code>$result = shell_exec("tar cf $sourceFile $sourceFolder -C $source  &gt; /dev/null; echo $?");
  var_dump($result);
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>string(2) "2 "
  </code></pre>
  
  <p>the <code>&gt; /dev/null; echo $?</code> thing is for outputing the result code of a script under linux;</p>
  
  <p>the <code>-C $source</code> - changes to the right folder before doing anything</p>
  
  <p>This is really strange because when i run this from linux console, it works just fine - creates the archive, so it's not a permission issue.</p>
  
  <p>Other sripts like "whoami" or "ls" work fine.</p>
  
  <p>Any ideas what does it mean?</p>