★ wanayoo — archive 1999 http://fr.php.net/manual/fr/function.umask.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previoustouchunlinknext
Last updated: Tue, 09 Jul 2002
view the printer friendly version or the printer friendly version with notes or change language to English | Brazilian Portuguese | Chinese | Czech | Dutch | Finnish | German | Hungarian | Italian | Japanese | Korean | Polish | Romanian | Russian | Slovak | Spanish | Swedish | Turkish

umask

(PHP 3, PHP 4 )

umask -- Change le "umask" courant.

Description

int umask ( int mask)

umask() change le umask de PHP : mask & 0777 et retourne le vieux umask. Lorsque PHP est utilisé comme module de serveur, le umask reprend sa valeur à la fin de chaque script.

umask() appelé sans argument retourne simplement le umask courant.

User Contributed Notes
umask
add a note about notes
rlynch at ignitionstate dot com
11-Feb-2000 01:41

umask affects permissions when files and directories are created.

umask is short for "Un-Mask".

So umask is "and"ed with the permissions of mkdir, fopen, etc.

In a sense, the umask setting is "subtracted" from the permissions given to mkdir.

Example:

<PRE>
umask(011);
mkdir('foo', 0777);
</PRE>
will actually make a directory with permissions 0766.

wptate at olemiss dot edu
29-Feb-2000 08:19

The -S option will print the symbolic values of umask, while changing the umask to the new setting.  
(i.e. umask -S 007 will print 'u=rwx,g=rwx,o=')

Barry at HostingMaster dot net
20-Feb-2001 08:24

If your scratching your head over this command, then look up mkdir() using the quick search and there at the bottom is my not so short explanation of discovery.  I do not copy it here for respect of the system and the length of my observation...  good luck...   (Thank God for PHP)

Barry L. Salter   (self proclaimed idiot, but not stupid by any means).

voudras at swiftslayer dot org
28-May-2001 12:47

save yourself some trouble by using umask with 4 digits, vs just three
sam at totallydigital dot co dot nz
20-Sep-2002 04:04

The first comment perhaps didn't quite make clear what's on with your umask and the permissions.

The permission passed to a command is first bitwise ANDed with the _INVERSE_ of the current umask, then applied to the file.

For example, umask = 0011 and permission = 0775
The inverse of 0011 = 0766

0775 AND 0766
= 111.111.101 AND 111.110.110
= 111.110.100
= 0764

add a note about notes
previoustouchunlinknext
Last updated: Tue, 09 Jul 2002
show source | credits | stats | mirror sites
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: nexen.net
Last updated: Thu Oct 31 04:18:43 2002 CET