Bobscrachy Posted December 17, 2007 Share Posted December 17, 2007 How do i save sessions into mysql using the session_set_save_handler? I tried following this tutorial here, but I got hung up on certain parts. 1) If it is setup so that you can keep session_start(); unchanged how does the script know to point towards a php file with the session_set_save_handler code? 2) Does each function of the session_set_save_handler IE ('_open','_close','_read','_write','_destroy','_clean'); need their own php files, or are they all stored in one big file? Quote Link to comment Share on other sites More sharing options...
trq Posted December 17, 2007 Share Posted December 17, 2007 1: Your call to session_set_save_handler needs to be included within each script that uses sessions. 2: You can place them all in one file, this file needs to be included within all your scripts that use sessions. Quote Link to comment Share on other sites More sharing options...
Bobscrachy Posted December 17, 2007 Author Share Posted December 17, 2007 Can it be placed above session_start();or will that cause a header error? Quote Link to comment Share on other sites More sharing options...
trq Posted December 17, 2007 Share Posted December 17, 2007 It actually needs to be called prior to session_start(). Why would it cause a header error? Quote Link to comment Share on other sites More sharing options...
Bobscrachy Posted December 17, 2007 Author Share Posted December 17, 2007 Because wouldn't that be having stuff before the session_start code. Warning: Cannot modify header information - headers already sent by() So is this legal? <?php require "bob.php"; session_start(); stuff; ?> where bob.php has all the session_set_save_handler code. Quote Link to comment Share on other sites More sharing options...
trq Posted December 17, 2007 Share Posted December 17, 2007 You can't have any output prior to session_start() is all. Quote Link to comment 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.