I have a php script that creates directories and sets the permission. Now I need to have that script set the owner and group of that created dir from 'nobody' to the site's owner.
When I run the following, I don't receive any errors, but it also doesn't change the owner. How can I get this to work? Is there something within cpanel that I need to disable?
When I run the following, I don't receive any errors, but it also doesn't change the owner. How can I get this to work? Is there something within cpanel that I need to disable?
Code:
$user = "username";
$path = "/home/".$user."/public_html/media/";
$own = "chown -R ".$user." ".$path."";
$own = escapeshellcmd($own);
exec($own);
if(!$own) {
die("Can not change ownership on the folder.");
}