tags:

views:

235

answers:

2

Hello,

When writing PHP session data to a database and using the session-set-save-handler() function you must write your own callback functions for each parameter. The first parameter of the open() function is the save path. In the tutorials I've seen they've provided a variable like "$save_path" like so:

    function open($save_path, $session_name)
{


...code...


return(true);
}

I don't know what I'm supposed to have as this first parameter. A variable that has the path to my DB as it's value?

Thank you for your time.

+2  A: 

The save_path is in the interface since the original session handling functions need it to know where to save the session files. You, however, can safely ignore this parameter, since you'll save to your database instead.

Also, since you won't call these functions directly it (PHP's session handler functions will), you need to put the parameter in the function. Just don't use it.

PatrikAkerstrand
A: 

$save_path is passed a value of session.save_path configuration directive. Different session storage engines may treat this value differently. For example, if you install Memcache extension, it adds memcached session storage capability. And this parameter should be set to a server/port of memcached server.

As you are developing your custom session storage mechanism, you can safely ignore this.

FractalizeR
Thanks you two. Is this first parameter of the open()function required as I won't be using it? The manual says:"The open function expects two parameters"
lanmind
Yes, you need onlyb $session_name. $save_path is not needed.
FractalizeR