Warning: file_put_contents(): Only -1 of 45 bytes written, possibly out of free disk space in /var/www/html/index.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 25
umask PodrÄ™cznik PHP Poprzedni NastÄ™pny (PHP 3, 4, 5) umask -- Changes the current Description int ( [int mask] ) umask() sets PHP's to mask & 0777 and returns old umask. When ...
Forum und email
umask

umask

(PHP 3, PHP 4, PHP 5)

umask -- Changes the current umask

Description

int umask ( [int mask] )

umask() 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.

umask() without arguments simply returns the current umask.

Notatka: Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod() after creating the file. Using umask() can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask.

Przykład 1. umask() example

<?php
$old
= umask(0);
chmod("/path/some_dir/some_file.txt", 0755);
umask($old);

// Checking
if ($old != umask()) {
    die(
'An error occured while changing back the umask');
}
?>