Re: mkdir and directory permissions

From: Date: Fri, 25 Oct 2002 11:09:28 +0000
Subject: Re: mkdir and directory permissions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-121411@lists.php.net to get a copy of this message
Actualy, you can use chgrp(), but apache must be a member of the group you are changing to. Jason Wong wrote:
On Friday 25 October 2002 06:51, Matias Silva wrote:
Hi-ya all, here's a quickie....... In my script I create a directory (mysql.backup.timestamp/) within a directory called backup/. I use the function mkdir("mysql.backup.timestamp", "0777"); and it shows the permissions as after the function executes:
   dr----x--t   2 nobody    daemon    1024 Oct 24 15:16
mysql.backup.October-24-2002-1516 Where's the permissions (dr----x--t 2 nobody daemon) coming from? Is it the php.ini, apache conf or the operating system?
The permissions (r----x--t) is coming from your mode setting in your mkdir() function AND from the system setting umask -- see manual -> umask() and check out user comments as well.
I would like to set the owner to "root" and the group to "nc". How can this be achieved by the php script? Or do I have set this up in the other environments (OS or Apache)?
You can't. The user:group comes from the user running the webserver, which in your case is nobody:daemon. Only root can the the user:group ownership of files and directories. So unless your webserver is running as root you cannot use chown()/chgrp().


« previous php.general (#121411) next »