today i wanted to know how i get a file's permission through php script, well you can do it

you can do this:

<?php
echo substr(sprintf('%o', fileperms('/directory')), -4);
echo substr(sprintf('%o', fileperms('/directory/subdirectory')), -4);
?>


OUTPUT
1777
0644


with this, you can verify or show what are the permissions for a certain file in php in your directories from your website.