Thanks for the explanation though I did know some of this already. What I'm
not sure of is how and where to use this.
Below is a little example of a member function that creates a new text file.

How/where should I use umask() ?
Also does it have any effect if the file isn't properly closet by fclose() ?

Little function example (member function of class file_handler):
--------------------------------------
function create_file($file_name) {
  if (!$this->fp = @fopen($file_name, wb)) {
   $this->error_msg .= $this->error_create ." ". $file_name .".";
   return false;
  } else {
   $this->file = $file_name;
   return $this->fp;
  }
 }
---------------------------------------

"Jill Ramonsky" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The PHP manual (unfortunately) assumes some Unix knowledge here.
> The paramter to umask is a bitfield, passed as an integer. Within this
> bitfield:
>
> bit 0 set implies that anyone in the world can execute the file
> bit 1 set implies that anyone in the world can write to the file
> bit 2 set implies that anyone in the world can read the file
> bit 3 set implies that anyone in the file's group (a Unix concept) can
> execute the file
> bit 4 set implies that anyone in the file's group (a Unix concept) can
write
> to the file
> bit 5 set implies that anyone in the file's group (a Unix concept) can
read
> the file
> bit 6 set implies that the owner of the file can execute the file
> bit 7 set implies that the owner of the file can write to the file
> bit 8 set implies that the owner of the file can read the file
>
> When accessing a file, the lower 9 bits of the permissions of the file (as
> stored on the server) are logically ANDed with the complement of the
current
> "umask" - which you can set with the umask() function - and the resulting
> bitfield is inspected to see whether or not to grant permission for the
> specified action.
>
> Jill
>
>
>
> -----Original Message-----
> From: Aidal [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 02, 2003 9:11 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] how to use umask() ???
>
>
> Hi NG.
>
> I'm having problems with my web application changing file permissions when
> creating, editing or deleting text files.
> My web host thinks it's because I need to use umask() but I'm not quite
sure
> just how to use this function.
>
> I've read the describtion on www.php.net but that didn't enlighten me
much.
> (As in, don't give me a link to www.php.net because it wont help me)
>
> Can anyone explain to me how to use this function?
>
> My php application creates, reads, wrrites, copies and deletes text files
> and I want the file permissions to stay intact.
> The application needs all permissions to the files: read, write and
execute
> (as i recall them stated when accessing through FTP).
>
> Any help would be much apreciated thanks...
>
> /Aidal
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to