grunff Posted August 5, 2007 Share Posted August 5, 2007 Hi all, I'm trying to fix a problem with a site which uses sessions. I keep seeing this error in the error log: PHP Warning: session_start(): open(/tmp/sess_6d5f9217920bb7a27c7108fec4587a20, O_RDWR) failed: Permission denied (13) in /home/public_html/includes/inc.php on line 1697 inc.php is the main site include, which is included on every page. The session handling bit looks like this: if ($ss != "") { session_id($ss); } session_start(); The variable $ss is used to pass the session id between the http: and https: sections of the site. Any idea as to why I'm getting this warning? Sessions are being created fine for both http and https. The only other possibly relevant bit of info is that it's set to use_only_cookies. Happy to provide more info if necessary. TIA Quote Link to comment https://forums.phpfreaks.com/topic/63420-php-warning-session_start-not-sure-why/ Share on other sites More sharing options...
mpharo Posted August 5, 2007 Share Posted August 5, 2007 session_start() must be called before you can use any session functions. Quote Link to comment https://forums.phpfreaks.com/topic/63420-php-warning-session_start-not-sure-why/#findComment-316079 Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 session_start() must be called before anything is outputed to the browser. Theorically this is a practice used in cookie-base sessions, but its better to have session_start() in the first line of your script. Quote Link to comment https://forums.phpfreaks.com/topic/63420-php-warning-session_start-not-sure-why/#findComment-316083 Share on other sites More sharing options...
grunff Posted August 5, 2007 Author Share Posted August 5, 2007 The PHP manual says that session_id() needs to be called before session_start(). http://uk2.php.net/manual/en/function.session-id.php Quote Link to comment https://forums.phpfreaks.com/topic/63420-php-warning-session_start-not-sure-why/#findComment-316136 Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 Ohh ok didnt know that as ive never used session_id(). I guess its not the same way of just using $_SESSION ! Quote Link to comment https://forums.phpfreaks.com/topic/63420-php-warning-session_start-not-sure-why/#findComment-316248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.