echo substr(sprintf('%o', fileperms('файл')), -4);
<? $file = 'index.php'; $perms = substr(sprintf('%o', fileperms($file)), -4); if($perms == '0777') { echo('<script>alert("Права на файл '.$file.' - 0777")</script>'); } ?>