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? Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/ 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. Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/#findComment-417226 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? Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/#findComment-417228 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? Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/#findComment-417231 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. Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/#findComment-417234 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. Link to comment https://forums.phpfreaks.com/topic/82106-sessions-saved-in-mysql/#findComment-417240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.