|
Posted by Chris on 10/09/37 11:38
That's the way safe-mode works.
The files going into the users/ folder are created by the "apache"
(webserver) user.
The script running is owned by your account (eg "sample").
Since the UID's aren't the same you can't do anything.
See http://www.php.net/features.safe-mode
You could ask the host if they can enable safe_mode_gid and make sure
that your user and the apache user are in the same group but that's
about all you can do apart from disabling safe-mode.
(there are no workarounds, that's just the way it works).
Joseph S. wrote:
> Hi all,
> Consider this case:
> I have a free php hosting account (a LAMP host) with an account name
> (also the name of my directory) 'sample'.
> Under 'sample', I have php scripts which can create files and folders
> programmatically. I have manually created a directory called 'users'
> under 'sample' and have given it a chmod 777 successfully.
>>From my script in 'sample', say myscript.php, I can successfully create
> any number of files inside sample/users/, say, sample/users/aaaaa.txt,
> sample/users/bbbbb.css, etc. I can also create directories at runtime,
> say, sample/users/mydir1, sample/users/mydir2 etc. and can also
> successfully chmod each to 777 (all this from myscript.php).
> The host is "running in SAFE MODE", where, it seems that for fopen,
> mkdir and many other functions, a check is done for the UID of the
> script-running process to be the same as the UID of each resource
> concerned(mydir1, mydir2, aaaaa.txt etc) and only if the UIDs match, is
> the function allowed to work successfully.
>
> The problem is that while I can make all these directories(mydir1,
> mydir2, etc) under sample/users and files aaaaa.txt and bbbbb.css under
> sample/users, I cannot make files inside mydir1, mydir2 etc. _inspite_
> of the fact that I can _successfully_(confirmed from independent
> filemanager utility) chmod all these created directories to 777.
>
> The message I get is something like: Warning fopen(): SAFE MODE
> restriction, the script whose UID is 12878 is not allowed to access
> sample/users/mydir3 owned by UID 99 in /path/to/script/myscript.php on
> line 484.
>
> This inspite of the fact that the newly created sample/users/mydir3 has
> been successfully chmodded to 777 as is visible from the host's
> filemanager utility!
>
> The same script has in the prior lines created the directory
> sample/users/mydir3 and many files like sample/users/ccccc.css,
> sample/users/dddddd.css and so on, without a problem. Plus, not having
> permissions on mydir3 is ruled out because the script just made it
> itself and chmodded it to 777.
>
> Any clues?
>
> Thanks in advance,
> Joseph S.
>
Navigation:
[Reply to this message]
|