CakeFest 2024: The Official CakePHP Conference

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 1 note

up
2
divinity76+spam at gmail dot com
2 years ago
if you for some reason need the euid without depending on php-posix being available, try

<?php
function 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;
}
}
To Top