public function isProcessRunning($pid) {
        if (!$pid) {
            return false;
        }

        // Is the PID running?
        $running = posix_kill($pid, 0);
        if (!$running) {
            return false;
        }

        // Did we have trouble pinging that PID?
        $psExists = !(bool)posix_get_last_error();

        return $psExists;
    }