★ wanayoo — archive 1999 http://fr.php.net/manual/nl/function.umask.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<touchunlink>
view the version of this page
Last updated: Fri, 11 Feb 2005

umask

(PHP 3, PHP 4 , PHP 5)

umask -- Veranderd de huidige umask

Beschrijving

int umask ( [int mask])

umask() verandert de umask van PHP naar mask & 0777 en geeft de oude umask terug. Als PHP gebruikt wordt als server module, dan wordt de umask weer herstelt nadat een request klaar is.

umask() zonder argumenten geeft simpel weg de huidige umask terug.



add a note add a note User Contributed Notes
umask
trisk at earthling dot net
31-Jan-2005 06:25
I thought I would clarify the numbering scheme used here, as it confused me at first.

On the UNIX console, the command:

umask "blah"

In this instance, the umask command forces "blah" to be an octal number, regardless of how many digits you use and regardless of any leading zeroes.  In PHP, umask() does not default to octal as the console command does, it uses whatever numeric format you specify.

For example:

umask(213);

This uses the decimal integer 213 and not the octal number 213 as you would expect when using the console command.  In this case, it would set the umask to the octal number "325".

To enter the number as octal, just add one or more zeroes to the left of the number:

umask(0213);
umask(07);
umask(0044);

etc.
notepad at codewalkers dot com
19-Jun-2004 03:43
$old = umask(0);
chmod("/some/dir", 0755);
umask($old);
sam at totallydigital dot co dot nz
20-Sep-2002 06: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
voudras at swiftslayer dot org
28-May-2001 02:47
save yourself some trouble by using umask with 4 digits, vs just three
wptate at olemiss dot edu
29-Feb-2000 10: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=')
rlynch at ignitionstate dot com
11-Feb-2000 03:41
umask affects permissions when files and directories are created.<BR>
umask is short for "Un-Mask".<BR>
So umask is "and"ed with the permissions of mkdir, fopen, etc.<BR>
In a sense, the umask setting is "subtracted" from the permissions given to mkdir.<BR>
Example:<BR>
<PRE>
umask(011);
mkdir('foo', 0777);
</PRE>
will actually make a directory with permissions 0766.

<touchunlink>
 Last updated: Fri, 11 Feb 2005
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This mirror generously provided by: nexen.net
Last updated: Sun Feb 20 05:11:36 2005 CET