10 recommended articles about the php umask() function

怪我咯
Release: 2023-03-08 18:42:01
Original
1814 people have browsed it

When using mkdir to create a folder, I found that this function has two parameters. The second parameter specifies permissions for the newly created folder. But if you use mkdir('file address', 0777); directly, you will find that the permissions of the new folder are not 777, but usually 022. Because when mkdir sets permissions for a folder, it performs a bitwise AND with the umask (user default permission attribute) value of the user currently logged in to the operating system, and the resulting value is the final permission value. What is umask? Where do the default permissions for files we create come from? How to change this default permission? When we log in to the system and create a file, there is always a default permission. So where does this permission come from? This is what umask does. umask sets the default permissions for files created by users. It has the opposite effect of chmod. umask sets the permission "complement code", while chmod sets the file permission code. Generally set in /etc/profile, $HOME/.bash_profile or $HOME/.profile

1.Solution to the problem of PHP mkdir() without write permission

10 recommended articles about the php umask() function

Introduction: This article mainly introduces the solution to the problem of PHP mkdir() without write permission, and details the umask. For explanations and solutions to the lack of write permissions after mkdir(), friends in need can refer to

2.php’s mkdir() function creates a safer permission setting for a folder Method

10 recommended articles about the php umask() function

Introduction: This article mainly introduces the mkdir() function of php to create a folder which is safer The permission setting method. The situation encountered is that the system umask affects the specified permission parameter of mkdir and is smaller than expected. Using the chmod function does not have this problem. Friends who need it can refer to it

3.phison-up10 mass production tool v1.78.00 PHP writing text log implementation code

Introduction: phison-up10 mass production tool v1.78.00:phison-up10 Mass production tool v1.78.00 PHP writing text log implementation code: Copy the code as follows:** * Write file* @param string $file file path* @param string $str write content* @param char $mode write mode* / function writeFile($file,$str,$mode='w') { $oldmask = @umask(0); $fp = @fopen($file,$mod

4.php umask function tutorial_PHP tutorial

Introduction: php umask function tutorial. php umask function tutorial umask value (PHP 4, PHP 5) umask - changes the current umask description int umask ([international $mask]) umask () sets the PHP umask value to mask

5.Detailed explanation of PHP Built-in function mkdir()_PHP tutorial

Introduction: Detailed explanation of PHP built-in function mkdir(). The function mkdir has two parameters, directory path and access permissions. Example mkdir(/tmp/ test,0777) Then the permission code to be obtained is not necessarily the one set above. The umask of the current system will be the same as the set value

6.php umask function Tutorial

Introduction: php umask function tutorial. php umask function tutorial umask value (PHP 4, PHP 5) umask - changes the current umask description int umask ([int $mask]) umask () sets the PHP umask value to mask

7.Detailed explanation of PHP built-in function mkdir()

Introduction: Detailed explanation of PHP built-in function mkdir(). The function mkdir has two parameters, directory path and access permission. For example, mkdir(/tmp/test,0777). Then the permission code to be obtained is not necessarily the one set above. The umask of the current system will be the same as the set value

8.MySQL umask causes backup error

10 recommended articles about the php umask() function

Introduction: However, the permissions of MySQL on the newly created database directory are 700; the permissions of the data table files are 660; this makes us confused. Does MySQL not rely on the values set by the system itself? refer to

9.Solution to the problem of PHP mkdir() without write permission_php example

Introduction: This article mainly introduces PHP mkdir ()The solution to the problem of no write permission, a detailed explanation of umask and the solution to the problem of no write permission after mkdir(), friends in need can refer to

10.php's mkdir() function creates a folder with a safer permission setting method_php example

Introduction: This article mainly introduces php's mkdir() function to create files A safer way to set permissions. The situation encountered is that the system umask affects the specified permission parameters of mkdir and is smaller than expected. Using the chmod function does not have this problem. Friends who need it can refer to it

[Related Q&A recommendations]:

centos - How to modify apache's umask?

apache - PHP development under linux (ubuntu) , How to set permissions for htdocs/wwwroot (directory and its subdirectories/files)

Why can’t the disk be run even after using umask=dmask=fmask=000 to mount the disk under Linux? Files on

nginx - Can the Web's file system umask be customized?

How to check the usage of shell built-in commands in Linux?

The above is the detailed content of 10 recommended articles about the php umask() function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!