Cineex Posted July 8, 2011 Share Posted July 8, 2011 I'm setting up my new live server using suPHP mod in apache but it dosen't seam to save session variables. If i do: session_start(); $_SESSION['foo'] = "foo"; $_SESSION['bar'] = "bar"; print_r($_SESSION); it will print out the sessions as it shoud do, but if i do session_start(); $_SESSION['foo'] = "foo"; $_SESSION['bar'] = "bar"; print_r($_SESSION); header('Location: otherpage.php'); and then on the other page do session_start(); print_r($_SESSION); some phpinfo(); session.auto_startOffOff session.bug_compat_42OffOff session.bug_compat_warnOffOff session.cache_expire180180 session.cache_limiternocachenocache session.cookie_domainno valueno value session.cookie_httponlyOffOff session.cookie_lifetime00 session.cookie_path// session.cookie_secureOffOff session.entropy_fileno valueno value session.entropy_length00 session.gc_divisor10001000 session.gc_maxlifetime14401440 session.gc_probability11 session.hash_bits_per_character55 session.hash_function00 session.namePHPSESSIDPHPSESSID session.referer_checkno valueno value session.save_handlerfilesfiles session.save_path/var/lib/php5/var/lib/php5 session.serialize_handlerphpphp session.use_cookiesOnOn session.use_only_cookiesOnOn session.use_trans_sid00 Quote Link to comment https://forums.phpfreaks.com/topic/241448-session-variables-are-not-saved/ Share on other sites More sharing options...
requinix Posted July 9, 2011 Share Posted July 9, 2011 What if you don't use a header()? If you manually go to the otherpage.php? Quote Link to comment https://forums.phpfreaks.com/topic/241448-session-variables-are-not-saved/#findComment-1240329 Share on other sites More sharing options...
cags Posted July 9, 2011 Share Posted July 9, 2011 Is the session save path writeable by the Apache user? Quote Link to comment https://forums.phpfreaks.com/topic/241448-session-variables-are-not-saved/#findComment-1240421 Share on other sites More sharing options...
Cineex Posted July 9, 2011 Author Share Posted July 9, 2011 What if you don't use a header()? If you manually go to the otherpage.php? That worked but do you know why ? Edit: nvm found it, putting: session_write_close(); just before the header and it worked, ty Quote Link to comment https://forums.phpfreaks.com/topic/241448-session-variables-are-not-saved/#findComment-1240452 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.