确定文件是否是系统文件,以及使用php的文件的所有者

I am trying to identify a way how to determine if a file is a system file or not using php. I also want to find out owner of the file and owner's domain.

I have tried different ways to determine if file is system file or not, i.e. is_file(), fileperms(). Next I am planning to build function around file name which returns true if file has extensions like .ini, .db, .tmp etc or the file name starts with "`". Let me know if someone has better idea to do this.

Also, I am trying to find out owner of the file and owner's domain like "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 also tired fileowner($file);// returned 0, I want something like "NTRSK\USER1".

You should use command line execution if you're on Linux

<?php
$output = shell_exec('ls -lh'); <-- for an example
echo "<pre>$output</pre>";      <-- use the output value to determine file status or owner depending on which command you're using. 
?>