posix_geteuid

(PHP 4, PHP 5, PHP 7, PHP 8)

posix_geteuid Restituisce l'ID dell'utente per il processo corrente

Descrizione

posix_geteuid(): int

Restituisce il valore numerico dell'ID dell'utente per il processo corrente. Vedere posix_getpwuid() per maggiori dettagli su come convertire il numero nel nome dell'utente.

add a note

User Contributed Notes 2 notes

up
2
divinity76+spam at gmail dot com
3 years ago
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;    }}
up
1
Anonymous
11 months ago
Please note the example code shown above is invalid and will fail, since UID 10001 cannot use posix_seteuid to change its UID to 10000
To Top