PHP permission (can create folder, but not subfolder)

view story

http://serverfault.com – 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? (HowTos)