I am working on a site which builds other sites. Some if it I use copy() to create the files and directories, other times I\'m building XML files in php and using DOMDocume
You can perform a system call
system("/bin/chmod -R $mod $root"); system("/bin/chown -R $user $root"); system("/bin/chgrp -R $user $root");
of course you use escapeshellarg() or escapeshellcmd() in order to avoid executing arbitrary commands