php man page for umask

Query: umask

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

UMASK(3)								 1								  UMASK(3)

umask - Changes the current umask

SYNOPSIS
int umask ([int $mask])
DESCRIPTION
umask(3) sets PHP's umask to $mask & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished.
PARAMETERS
o $mask - The new umask.
RETURN VALUES
umask(3) without arguments simply returns the current umask otherwise the old umask is returned.
EXAMPLES
Example #1 umask(3) example <?php $old = umask(0); chmod("/path/some_dir/some_file.txt", 0755); umask($old); // Checking if ($old != umask()) { die('An error occurred while changing back the umask'); } ?>
NOTES
Note Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod(3) after creating the file. Using umask(3) can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask. PHP Documentation Group UMASK(3)
Related Man Pages
umask(2) - debian
pam_umask(8) - linux
umask(2) - suse
pam_umask(8) - suse
umask(3) - php
Similar Topics in the Unix Linux Community
Perl Uploading Files
Unix File Permissions
umask with find
help on umask
Umask permission