note 91569 added to function.umask

From: Date: Wed, 17 Jun 2009 11:54:39 +0000
Subject: note 91569 added to function.umask
Groups: php.notes 
Request: Send a blank email to php-notes+get-156961@lists.php.net to get a copy of this message
I think that the best way to understand umask is to say that umask is used to revoke permissions, not to set permissions. umask sets which permissions must be removed from the system default when you create a file or a directory. For example, a mask 0022 means that you don't want group and others modify the file. default 0666 rw-.rw-.rw- umask 0022 ---.-w-.-w- Final 0644 rw-.r--.r-- That means that any file from now on will have 0644 permissions. It is important to understand that umask revokes, deletes permissions from system default, so it can´t grant permissions the system default hasn't. In the example above, with the 666 system default, there is no way you can use umask to create a file with execute permission. If you want to grant more permissions, use chmod. Be aware that system default permissions are not related to PHP (they depends upon server configuration). PHP has a default umask that is applied after system default base permissions. And there are different system default base permissions for files and directories. Usually, system default permissions for files are 666 and for directories 0777. And usually, default PHP umask is 0022 ---- Server IP: 80.64.47.13 Probable Submitter: 80.59.156.242 ---- Manual Page -- http://www.php.net/manual/en/function.umask.php Edit -- https://master.php.net/note/edit/91569 Del: integrated -- https://master.php.net/note/delete/91569/integrated Del: useless -- https://master.php.net/note/delete/91569/useless Del: bad code -- https://master.php.net/note/delete/91569/bad+code Del: spam -- https://master.php.net/note/delete/91569/spam Del: non-english -- https://master.php.net/note/delete/91569/non-english Del: in docs -- https://master.php.net/note/delete/91569/in+docs Del: other reasons-- https://master.php.net/note/delete/91569 Reject -- https://master.php.net/note/reject/91569 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156961) next »