title: exec - PHP return_val is 126
body: <p>I m trying to exec shell command within PHP script, but exec returns 126 code, which means "Command invoked cannot execute" (Permission problem or command is not an executable). But the funniest thing is that if I run the same php script under cli it works well. What's wrong with it?</p>
  
  <p>Maybe there some issues with environment? Because when I run it under Apache it returns 127 code if I don't use absolute path to executable file (under cli it works well and return 0, even if I use just file name).The file is stored in /usr/local/bin folder.</p>
  
  <p>UPDATE:</p>
  
  <p>As asked in comment, I show example of my code, but there are nothing special.</p>
  
  <p>This piece is working fine under cli, but doesn't work under apache (<code>$retval</code> will be equal to 127):</p>
  
  <pre><code>$output = array();
  $retval = 0;
  exec( "myexecutablefile /full/path/to/someotherfile.js", $output, $retval );
  echo implode( PHP_EOL, $output );
  </code></pre>
  
  <p>This piece of code will return <code>$retval = 126</code></p>
  
  <pre><code>$output = array();
  $retval = 0;
  exec( "/usr/local/bin/myexecutablefile /full/path/to/someotherfile.js", $output, $retval );
  echo implode( PHP_EOL, $output );
  </code></pre>