function - Recursive Chmod not working PHP -


i have below php function should recursively chmod 1 of dir's on server.

for reason it's not working - know path dir correct i've tested quick script prints out files within dir.

$root_tmp = '/tmp/mixtape2';  chmod_r($root_tmp);  function chmod_r($path) { $dp = opendir($path); while($file = readdir($dp)) {   if($file != "." , $file != "..") {      if(is_dir($file)){         chmod($file, 0777);         chmod_r($path."/".$file);      }else{          chmod($path."/".$file, 0777);      }   } closedir($dp); } 

any ideas?

chmod($path.'/'.$file, 0777); 

you must put full path chmod


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -