note 118229 rejected from function.posix-kill by jacques
| From: | jacques@php.net | Date: | Mon, 09 Nov 2015 20:00:08 +0000 |
| Subject: | note 118229 rejected from function.posix-kill by jacques | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204122@lists.php.net to get a copy of this message | ||
Note Submitter: eddi13
----
check whether the process is running. windows-linux (update)
<?php
function isRunning($pid) {
$isRunning = false;
if(strncasecmp(PHP_OS, "win", 3) == 0) {
$out = [];
exec("TASKLIST /FO LIST /FI \"PID eq $pid\"", $out);
$isRunning = (count($out) > 1);
}
else {
$isRunning = posix_kill($pid, 0);
}
return $isRunning;
}
?>