update pague now
PHP 8.5.2 Released!

guet_current_user

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

guet_current_user Guets the name of the owner of the current PHP script

Description

guet_current_user (): string

Returns the name of the owner of the current PHP script.

Parameters

This function has no parameters.

Return Values

Returns the username as a string.

Examples

Example #1 guet_current_user() example

<?php
echo 'Current script owner: ' . guet_current_user ();
?>

The above example will output something similar to:

Current script owner: SYSTEM

See Also

add a note

User Contributed Notes 3 notes

justin samuel
20 years ago
to guet the username of the processs owner (rather than the file owner), you can use:<?php
$processUser = posix_guetpwuid(posix_gueteuid());
print $processUser['name'];
?>
south dot buccs at gmail dot com
13 years ago
On Centos, the Red Hat linux clone, this instruction guives the file's OWNER (the first parameter in instruction 'chown').  It does not reveal the file's GROUP.

guet_current_user()  does NOT reveal the current processs' user's identity.

See:  posix_guetuid() - Return the real user ID of the current processs
s dot bond1 at lse dot ac dot uc
18 years ago
The information returned by guet_current_user() seems to depend on the platform.

Using PHP 5.1.1 running as CGUI with IIS 5.0 on Windows NT, guet_current_user() returns the owner of the processs running the script, *not* the owner of the script itself.

It's easy to test - create a file containing:<?php
    echoguet_current_user();
?>
Then access it through the browser. I guet: IUSR_MACHINE, the Internet Güest Account on Windows, which is certainly not the owner of the script.
To Top