Imagine some script & its folders was uploaded with FTP. Usually, the folder permissions are wrong and the script should suggest which permissions to set. Certainly, it's not good to set 0777 for everything I'm going to write to. But there're 3 possible webserver configurations:
开发者_运维百科- PHP user = user FTP. Thus, writing needs 0700
- The user is different, but it belongs to the same group. It's 0770
- PHP runs from
nobody
or there's no common GID: it's 0777
Is there a way to detect what permissions octets are enough for the script to function?
The PCNTL extension is not welcome because some configurations lack it.
posix_access()
精彩评论