How to get server user?
| From: | Jeffry Killen | Date: | Tue, 17 Feb 2015 01:59:06 +0000 |
| Subject: | How to get server user? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324463@lists.php.net to get a copy of this message | ||
I've been looking over the output from phpinfo to find a way
to portably get the server user name. It is not obvious to me...
Can I get that from an $_ENV or $_SERVER value?
I have a web base cms system with a file editor and
want to test for ownership of the files and directories
without having to hard code the server name.
I can get file owner ship but if I want to verify it is
the server user account, I would do:
(pseudo code)
$_name = getOwner()
if($_name == < portable reference to server user name>)
{
// proceed
}
This would be for enhanced access permissions analysis.
If a file is being written to by the server user (via php code)
it would be helpful to determine that to forstall error message
generation.
Thanks
JK