Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php检测并输出特定程序是否正在运行_Php_Linux_Bash_Output - Fatal编程技术网

使用php检测并输出特定程序是否正在运行

使用php检测并输出特定程序是否正在运行,php,linux,bash,output,Php,Linux,Bash,Output,基本上,我想知道一种非常简单的方法,用于检查php脚本是否在我的nix盒上运行特定程序 比如: <?php #some detection function here. if($detectprogram == 1){ echo("It's running."); } else{ echo("It's not running."); } ?> 也许你需要这个 exec("ps auxwww|grep sample.php|grep -v grep", $output); 资

基本上,我想知道一种非常简单的方法,用于检查php脚本是否在我的nix盒上运行特定程序

比如:

<?php

#some detection function here.

if($detectprogram == 1){ 
echo("It's running.");
}
else{
echo("It's not running.");
}
?>
也许你需要这个

exec("ps auxwww|grep sample.php|grep -v grep", $output);
资料来源: