[SCRIPT] Helper script for fixing file permissions - Joomla! Forum - community, help and support


hi all,

i ran issues upgrading version of joomla , turned out problem file permissions. instead of going through manually changing permissions have written php script can run (from cli) set permissions to:
directories: 775
everything else: 664

i know 664 not specified recommended in joomla documentation if host needs group permissions write access files solve.
of course, can change values own desires.

this has been tested on own live system , working fine. fixed update problem , have had no issues since running.

code: select all

<?php

function fixjoomlapermissions($f){
   if(is_dir($f)){
      //change permissions of directory
      chmod($f, 0775);
      //list contents of directory
      $dir=array();
      $handle=opendir($f);
      if(!$handle){
         die("unable open directory: ".$f."\n\n");
      }
      while(false !== ($entry=readdir($handle))){
         if($entry != '.' && $entry != '..'){
            $dir[]=$entry;
         }
      }
      closedir($handle);
      for($i=0,$fc=count($dir);$i<$fc;$i++){
         fixjoomlapermissions($f.'/'.$dir[$i]);
      }
   }else{
      //just fix permissions file
      chmod($f, 0664);
      return true;
   }
}

do{
   echo "enter path joomla installation: ";
   echo "\n";
   $basepath = trim(fgets(stdin));
}while(empty($basepath));
echo "beginning process...\n";
fixjoomlapermissions($basepath);
echo "done!\n\n";
?>

akeeba admin tools has feature well.





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support