when I run the below code, I got error “Fatal error: Call to undefined function posix_getpwuid()” in line $owner = posix_getpwuid($uid);.
- why?
- does that means there’s no owner when
$uid=0?
I know that $uid=0
$logfile = 'log.txt';
echo substr(sprintf('%o', fileperms($logfile)), -4)."<br />";
$uid = fileowner($logfile);
if ($uid === false) die("Could not determine file owner!");
$owner = posix_getpwuid($uid);
echo "The file owner's name is " . $owner[name] . "\r\n";
The error means exactly what it says: There is no such function
posix_getpwuid().However, since there obviously is, POSIX functions must be disabled on your server. Contact your host to find out if this is the case and why.
I believe a UID of 0 indicates the root user, but I don’t know enough about filesystems to know for sure.