PDA

View Full Version : PHP sessions, using MYSQL (on php.ini)


stormrider
6th October 2006, 15:36
Hello,

I'm wondering if it's possible to make PHP use MySQL instead of files to store the sessions from all the sites i host (things like changing session.save_handler on php.ini).

I haven't found anything on google :( and i would appreciate if someone can help me.

Thanks.

sjau
6th October 2006, 16:37
A simple search on google for "php mysql session" returned quite a few hits that seem to hold information...

stormrider
6th October 2006, 16:46
sjau,

I guess you are talking about how to implement mysql session storage for a single script or program.

When you start a sessions (session_start()), php store its information (session varibles) on /var/lib/php5 (depending of your conf) using files. What i'm trying to do is to store this information on MySQL.

falko
7th October 2006, 14:35
You can do it with the session_set_save_handler() function. Have a look at the section Custom Session Handlers on http://www.php.net/manual/en/ref.session.php and at http://www.php.net/manual/en/function.session-set-save-handler.php .

stormrider
7th October 2006, 15:39
Thanks falko.

It was possible to this using a software called sharedance ( http://www.php.net/manual/en/ref.session.php#47603 )