Jump to content

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


jeboy

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.