the server system is centos
with pagoda panel
php version is 7.2
the specific code is as follows
//"./attachment/qrcode/user"
$path="./attachment/qrcode/user";
if(!is_dir($path)){
mkdir($path,"0777",1);
}
//1.txt
1. The error is prompted first after running
mkdir(): Permission denied
check the directory where the files are generated, because attachment originally has 777 permissions, and the qrcode directory is generated, but the following user directory is not generated
2. After giving permission to qrcode directory 777, run it again with an error
.fopen(./attachment/qrcode/user/1.txt): failed to open stream: Permission denied
check the directory where the generated files are generated. If the user directory is generated, you will continue to set the 777 permissions to the user directory without permission.
run it again, and the 1.txt file will be generated successfully
the code has set "mkdir ($path," 0777 ", 1);"
should be generated recursively according to the path and set 777permissions.
what is the reason for this?