//test.php
<?php
exec("git --version",$res1);
var_dump($res1);
exec("whoami",$res2);
var_dump($res2);
?>
导致cli模式:php -f test.php
array(1) {
[0]=>
string(17) "git version 2.2.1"
}
array(1) {
[0]=>
string(5) "nginx"
}
导致nginx(chrome):
array(0) { } array(1) { [0]=> string(5) "nginx" }
cli和nginx都以nginx用户身份运行