Q:

PHP permission (can create folder, but not subfolder)

So I use mkdir, intend to create two folders like this
$dir1 = 'upload/'.$id;
$dir2 = 'upload/'.$id.'/s';
if (!is_dir($dir1)){
    mkdir($dir1, 0744);
    mkdir($dir2, 0744);
}
This command successfully creates the two folders I need in my xampp localhost.
However in my nginx linux cloud vm, only the $dir1 can be created.
I have already give the ownership of the 'upload/' folder to nginx, and it is strange that one of the folder works but not another. Do anyone know what is wrong about this?

A:

A different question: Why are you making a directory with 0744 perms?  Set in this way, only root and the owner could access files below it.  The normal perms for a directory to allow open access is 0755.

