PDA

View Full Version : wierd php umask problem?


BenSkiddle
05-03-2005, 05:53 PM
I have php 4.3.11 running on FreeBSD 5.3 and Apache 2.0.52 (php running as a cgi)

Recently I have had lots of problems with file permissions when creating new files. Everything was working fine before I upgraded to 4.3.10

I think I have tracked this down to the umask value. I dont set this anywhere on my scripts. However, if I
PHP Code:
echo umask();
on a test page, sometimes it shows '18' and sometimes it shows '63'

I can refresh the page and it flips between 18 and 63. There is only one other site on the server so im pretty sure nothing else is changing the config

This is causing all sorts of problems - any ideas??

sabret00the
05-05-2005, 07:13 PM
after just reading about this on php.net couldn't you just set a chmod value before you attempt what you're attempting and then unset it?

notepad at codewalkers dot com
19-Jun-2004 02:43
$old = umask(0);
chmod("/some/dir", 0755);
umask($old);