Page 1 of 1

safe mode issues

Posted: Tue Dec 23, 2003 1:48 pm
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*

Posted: Wed Dec 24, 2003 1:23 am
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

volka, my man...

Posted: Wed Dec 24, 2003 1:42 am
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

Posted: Wed Dec 24, 2003 1:52 am
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 ;)

Plesk and Safe Mode

Posted: Tue Dec 12, 2006 12:04 pm
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 :)