Search code examples
phpfile-permissions

Check file permissions


How can I check file permissions, without having to run operating system specific command via passthru() or exec()?


Solution

  • Use fileperms() function

    clearstatcache();
    echo substr(sprintf('%o', fileperms('/etc/passwd')), -4);