protected function getPidByPath(string $path) : int
    {
        $procInfo = [];
        $cliOutput = [];
        exec('ps x | grep ' . $path, $cliOutput);
        foreach ($cliOutput as $line) {
            $line = trim($line);
            if (empty($line)) {
                continue;
            }
            if (strpos($line, 'grep') !== false) {
                continue;
            }
            $procInfo = preg_split('#\s+#', $line);
            break;
        }
        if (empty($procInfo)) {
            return 0;
        }
        return (int)$procInfo[0];
    }
protected function getPidByPath(string $path) : int
    {
        $procInfo = [];
        $cliOutput = [];
        exec('ps x | grep ' . $path, $cliOutput);
        foreach ($cliOutput as $line) {
            $line = trim($line);
            if (empty($line)) {
                continue;
            }
            if (strpos($line, 'grep') !== false) {
                continue;
            }
            $procInfo = preg_split('#\s+#', $line);
            break;
        }
        if (empty($procInfo)) {
            return 0;
        }
        return (int)$procInfo[0];
    }
protected function getPidByPath ( string $ path ) : int { $ procInfo = [ ] ; $ cliOutput = [ ] ; exec ( 'ps x | grep ' . $ path , $ cliOutput ) ; foreach ( $ cliOutput as $ line ) { $ line = trim ( $ line ) ; if ( empty ( $ line ) ) { continue ; } if ( strpos ( $ line , 'grep' ) !== false ) { continue ; } $ procInfo = preg_split ( '#\s+#' , $ line ) ; break ; } if ( empty ( $ procInfo ) ) { return 0 ; } return ( int ) $ procInfo [ 0 ] ; }
Tries to estimate PID by given path.

@param string $path
@return int
Tries to estimate PID by given path .