Jump to content

[SOLVED] Question - RE: Saving session data to database


Recommended Posts

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.