i need to create nested directories with chmod 777, i tried following code but every directory created with chmod 755 in CentOS, in windows this code create directories with chmod 777, whats the problem?
Code: Select all
$dir = "a";
$folders = array('b','c','d');
foreach($folders as $f)
{
$dir = $dir."/".$f;
if(!is_dir($dir))
{
if(mkdir($dir))
echo $f.' was created<br>';
else
echo 'failed to create '.$f.'<br>';
if(chmod($dir, 0777))
echo $f.' chmod converted to 777<br>';
else
echo 'failed to convert '.$f.' chmod to 777<br>';
}
}
i tried to create my path (eg: 'a/b/c/d') with mkdir('a/b/c/d',0777,true) but this code create directories with chmod 755 too, i didnt success to convert chmod to 777 by applying chmod() to every directories, what can i do to create a path like 'a/b/c/d' with chmod 777 for every directories in CentOS?