Unix and Linux Discussions Tagged with umask |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
8 |
10,015 |
Solaris |
|
|
|
1 |
9,908 |
UNIX for Advanced & Expert Users |
|
|
|
3 |
2,362 |
AIX |
|
|
|
15 |
11,962 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
6,797 |
Shell Programming and Scripting |
|
|
|
6 |
331,690 |
Tips and Tutorials |
|
|
|
3 |
7,426 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
13,713 |
UNIX for Advanced & Expert Users |
|
|
|
7 |
15,598 |
Solaris |
|
|
|
2 |
11,218 |
Shell Programming and Scripting |
|
|
|
3 |
17,494 |
Ubuntu |
|
|
|
3 |
27,198 |
UNIX for Dummies Questions & Answers |
|
|
|
0 |
5,322 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
19,087 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,630 |
UNIX for Dummies Questions & Answers |
|
|
|
6 |
10,963 |
Linux |
|
|
|
3 |
55,985 |
HP-UX |
|
|
|
3 |
15,878 |
Solaris |
|
|
|
3 |
3,676 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
11,105 |
AIX |
|
|
|
2 |
5,153 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
6,301 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
17,119 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
4,634 |
UNIX for Dummies Questions & Answers |
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)