0

I have this code to create recursive directories:

define('_PATH', '/www/virtual/user/galleries');
$gallery_path = "/".intval($gallery['id']);

if(!is_dir(_PATH.$gallery_path))
    mkdir(_PATH.$gallery_path, 0777, false);

I made the parent directory ('galleries') writable (0777). I can confirm that the directory is created. However, it is NOT created with 0777 permissions, but with 0755! I have no explanation for this. :-(

reggie
  • 3,523
  • 14
  • 62
  • 97
  • Your code show that you are attempt to create a directory when NOT exist. What if the directory already exist? It just inherit the existing mod. – ajreal Mar 03 '13 at 14:32
  • 1
    probably this is useful http://stackoverflow.com/questions/3997641/why-cant-php-create-a-directory-with-777-permissions – Tearsdontfalls Mar 03 '13 at 14:39
  • Thanks, tearsdontfalls, it looks like umask is the problem. – reggie Mar 04 '13 at 10:01

0 Answers0