You are here: SAFE MODE,fopen, and chmod « PHP Programming Language « IT news, forums, messages
SAFE MODE,fopen, and chmod

Posted by Joseph S. on 11/04/05 13:00

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация