未经测试,但在创建文件夹后,您可以运行另一行代码来更改所有者/组
$owner = "dropbox";
$group = "dropbox";
$folder = "/home/dropbox/New_Project_Name/new_folders";
chown($folder, $owner);
chgrp($folder, $group);
Keep in mind, that it might throw an error, because there are subfolders and the operation fails. A while loop should solve the problem.
There might be an issues with the permissions, up to the server-config
There is another way to run it recursively with the "exec" command.
you can go like this:
exec("chown -R ".$owner.":".$group." ".$folder);
This will change user and group for the folder and all sub-folders. But beware,
using system is "dangerous". You can run any shell-commands. Don't play around with it too much.
code
nobody ALL = NOPASSWD: /home/user/public_html/change_owner.php - Wonder Works