I have a custom cms that uses sessions o store some data. The webserver I'm on suddenlt changed turned safe_mode on in PHP. This means I can't use sessions anymore. Is there a workaround for this when putting safe_mode off is no option?
Asked
Active
Viewed 1,349 times
1
-
1There shouldn't be any problem to use session with safe mode. – Alvarez Oct 17 '12 at 13:42
-
Sessions are fine with safe mode. However, safe mode itself is considered obsolete -- it should not be used (because it isn't actually 'safe'). Safe mode has been deprecated in the lowest currently supported version of PHP (5.3) and removed entirely from PHP 5.4. If your host has just turned it on, they are *way* out of date, and you should be seriously considering ditching them and finding a better host. See notes on the relevant PHP manual page: http://php.net/manual/en/features.safe-mode.php – SDC Oct 17 '12 at 15:47
1 Answers
1
According to the php manual of sessions
, the fact that your server is in safe mode
won't cause a problem with your sessions.
http://www.php.net/manual/en/intro.session.php
However , the session_start()
function might be disabled in safe mode , under the next condition:
The owner of a script must be the same as owner of a session.save_path directory if the default files session.save_handler is used.
In order to resolve this problem , contact your hosting company and ask for a local ini file (php settings) , then edit the value of session.save_path
and make sure that this path exists in your server.

Ofir Baruch
- 10,323
- 2
- 26
- 39
-
Thanks, how do I start a the Session When the session.save_path is set to an existing path. Also with session_start() ? – waterschaats Oct 17 '12 at 14:31
-
According to the condition mentioned above , after editing it and targeting it to an existing path in YOUR server - you simply use the `session_start` function. – Ofir Baruch Oct 17 '12 at 14:32