Re: files created with mkdir and open(file,"w+) are owned by nobody

From: Date: Mon, 07 May 2001 17:38:56 +0000
Subject: Re: files created with mkdir and open(file,"w+) are owned by nobody
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51785@lists.php.net to get a copy of this message
the owner of the files i believe will be hte user running the webserver since the webdserver itself is making the files. apache by defauly runs as nobody:nobody if you want to change this i think php has a chown funciton or you can run your webserver as a different user name/group Ryan Hilton wrote: > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#51785) next »