jeboy Posted February 5, 2008 Share Posted February 5, 2008 I've read an article regarding saving session data to a table in database (http://www.raditha.com/php/session.php). I would like to ask if its required to always call the session_set_save_handler() function for every page that needs a session? Quote Link to comment https://forums.phpfreaks.com/topic/89493-solved-question-re-saving-session-data-to-database/ Share on other sites More sharing options...
Aureole Posted February 5, 2008 Share Posted February 5, 2008 I'm fairly certain that it is required. Quote Link to comment https://forums.phpfreaks.com/topic/89493-solved-question-re-saving-session-data-to-database/#findComment-458396 Share on other sites More sharing options...
PFMaBiSmAd Posted February 5, 2008 Share Posted February 5, 2008 The answer is yes. All the code shown at that link must exist before every session_start() in your code. Because PHP code is parsed and interpreted, using the session_set_save_handler() method is at least 10x slower then using php's built in handler, which is written in complied C code. If your concern is the possibility that the session data files could be accessed by another accounts on a shared server, the solution is simple, just change session.save_path to point to a private folder (either located outside your document root folder or within your document root folder but protected using a .htaccess file) within your account's disk space. Quote Link to comment https://forums.phpfreaks.com/topic/89493-solved-question-re-saving-session-data-to-database/#findComment-458508 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.