Team

chmod("/home/www/tools/", 0777); 

changes the rights only to the tools folder, does not change them for nested ones.

If through the console, then the command

 chmod -R 777 tools 

You can change the rights recursively.

And how to do this through the PHP function chmod, without looping through all the subfolders and files?

  • Is that only through exec - Daniel Protopopov

1 answer 1

And how to do it through the PHP function chmod, without going through the loop

No

  • one
    I will add for understanding. chmod - as the utility calls the chmod() - library function. For the convenience of the user, the utility performs some additional operations. In particular, it recursively iterates through files and directories and calls chmod() for each one. PHP function - in fact - a wrapper over the library C function whose functionality is minimal - tutankhamun