0

I would like to execute a statement on my website, the server environment is LNMP, the single always return 127, can not be executed.


$dir = 'php /alidata/www/index.php gitblog exportsite';
exec("$dir",$output,$is_success);
print_r($output);
echo"<br>";
echo $is_success;
echo"<br>";
J.Cai
  • 3
  • 2

1 Answers1

0

Error code 127 is returned for an illegal command. Try

$output=array(); // $output should be an array
$dir = '/alidata/www/index.php gitblog exportsite';
exec("$(which php) $dir",$output,$is_success);
sjsam
  • 21,411
  • 5
  • 55
  • 102
  • i use your way,and now its return 126,there is nothing in the $output – J.Cai Aug 31 '16 at 12:49
  • @J.Cai : That looks like a permission issue to me. Check [\[ this \]](http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/exitcodes.html) list to know more.. – sjsam Aug 31 '16 at 13:07