0

I want to change the file permissions to chmod('file',0755) but it is not working:

if(chmod("filepath",0755)){
    $fp = fopen("filepath", "r+");
if (flock($fp, LOCK_EX)) {  // acquire an exclusive lock
                ftruncate($fp, 0);      // truncate file
                fwrite($fp, "Order no Synchronization\n");
                fflush($fp);   
flock($fp, LOCK_UN); 
} 
}
else{
    echo "Not able to change permissions";
}

The above code is not working for me.

0015
  • 121
  • 1
  • 3
  • 10

1 Answers1

0

exec is used to run command directly on your terminal whith the help of this you can change forcefully permission to your file and directory

exec("chmod -R 755 $filepath");//$filepath is the path of your file or folder
Saty
  • 22,443
  • 7
  • 33
  • 51
  • 1
    No need for `exec()` if there is already functions in php for this! Also with no explanation this won't help much neither OP nor further readers – Rizier123 Apr 10 '15 at 06:25