Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Do you get an error message? Also, why don't you use the recursive mode of mkdir to create them in one go? – Alastair McCormack Oct 11 '12 at 18:38
up vote 1 down vote accepted

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.

share|improve this answer
O 0755 works! I see what I missed. I am checking my VM using filezilla and the inner folder with ownership [nginx nginx] is not visible to me(logging in not as root). Thanks a lot! – StCee Oct 11 '12 at 19:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.