20 include_once (
"Lib.Common.php");
27 $path_env = getenv(
"PATH");
28 if ($path_env ==
false) {
31 foreach (explode(
":", $path_env) as
$path) {
32 if (file_exists(
"$path/$cmdname")) {
33 return "$path/$cmdname";
41 return php_uname(
'n');
58 return getenv(
"SERVER_NAME");
63 return getenv(
"SERVER_ADDR");
71 static function ssystem($args, $opt = null)
78 $ret = pcntl_waitpid($pid, $status);
82 return pcntl_wexitstatus($status);
85 if ($opt && array_key_exists(
'envs', $opt) && is_array($opt[
'envs'])) {
88 if ($opt && array_key_exists(
'closestdin', $opt) && $opt[
'closestdin'] ===
true) {
91 if ($opt && array_key_exists(
'closestdout', $opt) && $opt[
'closestdout'] ===
true) {
94 if ($opt && array_key_exists(
'closestderr', $opt) && $opt[
'closestderr'] ===
true) {
97 $cmd = array_shift($args);
98 pcntl_exec(
$cmd, $args, $envs);
103 if (is_link(
$path)) {
106 return realpath(
$path);
111 if (
$dir === null ||
$dir ===
false) {