Re: move_uploaded_file, umask, and permissions
| From: | Curt Zirzow | Date: | Mon, 01 Dec 2003 06:03:39 +0000 |
| Subject: | Re: move_uploaded_file, umask, and permissions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171433@lists.php.net to get a copy of this message | ||
* Thus wrote David T-G (davidtg-php@justpickone.org):
> Hi, all --
>
> I have set my umask to 117 (and I change it when making a directory) and
> I use move_uploaded_file to handle submitted files.
>
> The temporary file is mode 600 when it lands in /var/tmp but somehow gets
> changed to 666 during the move. It seems that move_uploaded_file changes
> the file perms and yet does not honor the umask.
>
> Must I really run chmod() on every move_uploaded_file() I process? Isn't
> there a better way?
I believe it does, move_uploaded_file() uses the current
envirionment's umask which seems to be set at an awkward stage.
what is the output of:
echo
umask;
I bet its '11'. I'm not sure how your system is configured but it
seems the user apache is running under has that umask set that way
which, IMO, is a bad thing (tm).
Curt
--
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP