Determine if a file is a system file or not and also the owner of the file using php
I'm trying to figure out a way to determine if a file is a system file or not using php. I also want to know the owner of the file and the domain owner.
I have tried different ways to determine if a file is a system file or not, i.e. is_file()
, fileperms()
. Then I plan to construct a function around the name of the file that returns true, if the file extension, such as .ini
, .db
, .tmp
, etc., or a file name that begins with "` ". Let me know if anyone has an idea to do this.
Also, I am trying to figure out the owner of the file and the domain of the owner, for example "NTRSK\USER1"
for this I tried
$stat = stat($file);
// returns 0 always
echo(posix_getpwuid($stat['uid']));
// got fatal error 'undefined function posix_getpwuid()'
I'm tired too fileowner($file);// returned 0
, I need something like "NTRSK\USER1"
.
source to share