title: php exec() command permission denied
body: <p>I have a C++ executable file 'skypeforwarder'. skypeforwarder works if I use command line in Terminal in Mac:
    henry$ /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder</p>
  
  <pre><code>sh: /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder: Permission denied
  </code></pre>
  
  <p>But it always issued 'permission denied' if it is called in php exec();</p>
  
  <pre><code>&lt;?php 
  echo exec('whoami');
  
  $output = null;
  
  $execBuild = '/Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/';
  $execBuild .= 'skypeForwarder';
  
  $n  = exec($execBuild, $output); 
  </code></pre>
  
  <p>I searched a lot. The problem should be the problem of the php/browser permission in web server. I also tried to change the owner of the file from: </p>
  
  <pre><code>-rwxr-xr-x  1 henry  staff  1212716 19 Apr 11:23 skypeForwarder
  </code></pre>
  
  <p>to</p>
  
  <pre><code>-rwxr-xr-x  1 _www  staff  1212716 19 Apr 11:23 skypeForwarder
  </code></pre>
  
  <p>It still does not work.</p>
  
  <p>I set the apache in my mac according to <a href="http://foundationphp.com/tutorials/php_leopard.php" rel="nofollow">http://foundationphp.com/tutorials/php_leopard.php</a></p>