files created with mkdir and open(file,"w+) are owned by nobody
| From: | Ryan Hilton | Date: | Mon, 07 May 2001 16:33:32 +0000 |
| Subject: | files created with mkdir and open(file,"w+) are owned by nobody | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51768@lists.php.net to get a copy of this message | ||
I'm creating directories and files inside of a php program and they are
owned by nobody.
How can I assign an owner to them and who should the owner be?
Where is documentation for these types of questions?
Here is the code snipet:
create a directory - I would also like to create it with 775 privledges, but
I can't create a file in the directory unless it is 777:
if(!file_exists(DIRECTORY))
{
// create the directory
$oldumask = umask(0);
mkdir(DIRECTORY, 0777); // or even 775 is more secure
umask($oldumask);
if(!is_dir(DIRECTORY))
{
$return_status[0] = false;
$return_status[1] = "there was an error creating the directory.";
return $return_status;
}
}
create a file:
$fd = fopen($file,"w+");
if(!$fd)
{
$return_status[0] = false;
$return_status[1] = "3) A system configuration error has been detected.
Your request cannot be processed.";
return $return_status;
}
Thanks in advance for your help,
Ryan