1

I have the following code :

if  (!file_exists('/public_html/'.'classic/'.'test'.'/'))  {
    if(!mkdir('/public_html/'.'classic/'.'test'.'/',  0777,  true))  {
        return  false;
    }
}

This create only the folder /classic witch have the permission 0755 and another owner. How to change to create recusively 2 folders : /classic/test/ ? Thx in advance and sorry for my english

Harea Costicla
  • 797
  • 3
  • 9
  • 20
  • Give permission to main directory then all subdirectory inside it is automatically get updated with new permission. – Shailesh Katarmal Dec 15 '15 at 09:53
  • Why are you using dots between the different folder names? Mode doesn't seem to work on Windows. Are you on Windows? – RST Dec 15 '15 at 09:54

1 Answers1

0

I found a solution by using umask :

$oldumask = umask(0);
mkdir('mydir', 0777); // or even 01777 so you get the sticky bit set
umask($oldumask); 
Harea Costicla
  • 797
  • 3
  • 9
  • 20