if you for some reason need the euid without depending on php-posix being available, try<?phpfunction geteuid_without_posix_dependency(): int{ try { // this is faster if available return \posix_geteuid(); } catch (\Throwable $ex) { // php-posix not available.. fallback to hack $t = tmpfile(); $ret = fstat($t)["uid"]; fclose($t); return $ret; }}