safe mode issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
myrth
Forum Newbie
Posts: 2
Joined: Tue Dec 23, 2003 1:48 pm

safe mode issues

Post by myrth »

greetings,

my code :
13: $f = fopen($fileName, 'a+');

the issue:
Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid is 504 is not allowed to access /html owned by uid 48 in /html/pretes.php on line 13

my php.ini:
safe_mode = Off
safe_mode_gid = Off
;safe_mode_include =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_ TZ
safe_mode_protected_env_vars = LD_LIBRARY_PATH
;open_basedir =

the phpinfo():
--> local value then master value
safe_mode On Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value

anyone have any help to give? :)

thanks.

-myrth

PS - the first person to help me get this fixed get's a $1.00 paypal donation for their time. ;) *this is not a joke*
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

each file has an owner (directories are handled mainly like files). That is an id corresponding to a (hopefully existing) account on that system.
The webserver (and so your script as well) also runs with the permissions of a certain account. The id of this account is assigned to the process (uid and euid, user-id and effective user-id).
Safemode now checks wether the ids of the script(-process) and the file match. If not you get the error above.

safe_mode On Off inidicates that safemode has been enabled anywhere else but in php.ini
For an apache server this might have been done as described at http://www.php.net/manual/en/configurat ... ges.apache
either change this directive (if possible) or make script-id and file/dir-id match.
You may change the owner of a file with the command chown
http://php.net/features.safe-mode#ini.safe-mode-gid might be interesting, too
myrth
Forum Newbie
Posts: 2
Joined: Tue Dec 23, 2003 1:48 pm

volka, my man...

Post by myrth »

...you are the master guru that they said you were!

you're very informative post has made me have very good headway on this problem, and it is now fixed! :)

what's your paypal account and that $1 is yours! ;)

-myrth
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

hm, maybe I should sign up there...
on the other hand the might feel the need to spare an extra buck on a poor fellow
It's christmas anyway, isn't it ;)
mltsy
Forum Newbie
Posts: 9
Joined: Mon Jul 11, 2005 12:46 pm
Location: Minnesota, USA

Plesk and Safe Mode

Post by mltsy »

I had this problem, where safe mode wouldn't turn off - after much searching, I was lead back to my plesk control panel where there is an option to turn on safe mode. Just thought I'd solve that problem for anyone else who has it :)
Post Reply