- Forums
- PHP
- How To Get File Permission In Php Getting Files Permission
This Page Contains information about How To Get File Permission In Php Getting Files Permission By wallpaperama in category PHP with 3 Replies. [1114], Last Updated: Tue Feb 07, 2023
wallpaperama
Sat Mar 01, 2008
3 Comments
4778 Visits
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.