Can the above be done?

The chmod alters only a dir or file permission.

What about recursively alternation of a dir's subdirs permission?

    You could [man]shell_exec()[/man] (or something similar) with chmod -R xxx /path
    If you want to do it with PHP you're going to have to write yourself a little recursive function.

      I tried the first solution but it failed.

        Well you either didn't do it right

        From the chmod Man page
        -R, --recursive
        change files and directories recursively

        or the user you're running the command as doesn't have enough permissions.
        Oh, you did replace xxx with the numeric permission code you wanted for the files and /path with the path concerned didn't you?

          It does'nt work because php may run in safe mode.

            Write a Reply...