mysql user session handler

mysql user session handler

am 08.09.2009 19:23:07 von Tom Worster

questions for those of you with a user session handler using mysql:

did you write your own handler, write one based off some other you found (if
so, which?), or are you using some available library (if so, which?)?

and how do you feel about your implementation? satisfied? or are there
improvements you'd like to have?

and what serializer do you use?

i have my own set of handler functions (less than 70 loc) which seem to work
in simple testing. but, while i'd really like to have the sessions in the db
for redundancy, i haven't had the courage to deploy it yet. i derived the
code from something i found on the web. i trust everything i read on the
internet ;-)

-tom




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: mysql user session handler

am 08.09.2009 20:23:26 von Devendra Jadhav

--000feaf109cffcd4e30473150f06
Content-Type: text/plain; charset=ISO-8859-1

http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Dat abase/


On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster wrote:

> questions for those of you with a user session handler using mysql:
>
> did you write your own handler, write one based off some other you found
> (if
> so, which?), or are you using some available library (if so, which?)?
>
> and how do you feel about your implementation? satisfied? or are there
> improvements you'd like to have?
>
> and what serializer do you use?
>
> i have my own set of handler functions (less than 70 loc) which seem to
> work
> in simple testing. but, while i'd really like to have the sessions in the
> db
> for redundancy, i haven't had the courage to deploy it yet. i derived the
> code from something i found on the web. i trust everything i read on the
> internet ;-)
>
> -tom
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Devendra Jadhav

--000feaf109cffcd4e30473150f06--

Re: mysql user session handler

am 09.09.2009 03:29:22 von Tom Worster

thanks, Devendra, that's pretty much the same as my handler. (though i can't
figure Rich Smith's $sess_save_path global. do you know what is for?)

but what i'm really interested in is people's experience in switching over
to and using this kind of handler: pitfalls, gotchas, etc. or is it really
as easy and simple as all these online articles i've read about it claim?

or is that experience so hard won that people aren't keen to share it?

-tom

On 9/8/09 2:23 PM, "Devendra Jadhav" wrote:

> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Dat abase/
>
>
> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster wrote:
>
>> questions for those of you with a user session handler using mysql:
>>
>> did you write your own handler, write one based off some other you found
>> (if
>> so, which?), or are you using some available library (if so, which?)?
>>
>> and how do you feel about your implementation? satisfied? or are there
>> improvements you'd like to have?
>>
>> and what serializer do you use?
>>
>> i have my own set of handler functions (less than 70 loc) which seem to
>> work
>> in simple testing. but, while i'd really like to have the sessions in the
>> db
>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>> code from something i found on the web. i trust everything i read on the
>> internet ;-)
>>
>> -tom
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: mysql user session handler

am 09.09.2009 04:06:07 von Gabriel Sosa

I'm our case we opt for memcache to store the sessions
Mmc its soo much faster and you will have less net overhead because
the simple protocol
Also the configuration its easier. If you see in the php manual you
only need to touch two lines in the php.ini

On 9/8/09, Tom Worster wrote:
> thanks, Devendra, that's pretty much the same as my handler. (though i can't
> figure Rich Smith's $sess_save_path global. do you know what is for?)
>
> but what i'm really interested in is people's experience in switching over
> to and using this kind of handler: pitfalls, gotchas, etc. or is it really
> as easy and simple as all these online articles i've read about it claim?
>
> or is that experience so hard won that people aren't keen to share it?
>
> -tom
>
> On 9/8/09 2:23 PM, "Devendra Jadhav" wrote:
>
>> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Dat abase/
>>
>>
>> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster wrote:
>>
>>> questions for those of you with a user session handler using mysql:
>>>
>>> did you write your own handler, write one based off some other you found
>>> (if
>>> so, which?), or are you using some available library (if so, which?)?
>>>
>>> and how do you feel about your implementation? satisfied? or are there
>>> improvements you'd like to have?
>>>
>>> and what serializer do you use?
>>>
>>> i have my own set of handler functions (less than 70 loc) which seem to
>>> work
>>> in simple testing. but, while i'd really like to have the sessions in the
>>> db
>>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>>> code from something i found on the web. i trust everything i read on the
>>> internet ;-)
>>>
>>> -tom
>>>
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Sent from my mobile device

Gabriel Sosa
Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: mysql user session handler

am 09.09.2009 10:16:54 von M.Ford

> -----Original Message-----
> From: Tom Worster [mailto:fsb@thefsb.org]
> Sent: 09 September 2009 02:29
>=20
> thanks, Devendra, that's pretty much the same as my handler. (though
> i can't
> figure Rich Smith's $sess_save_path global. do you know what is
> for?)

I think if you look at the comments on that article, he's agreed that's an =
error and shouldn't be there.

> but what i'm really interested in is people's experience in
> switching over
> to and using this kind of handler: pitfalls, gotchas, etc. or is it
> really
> as easy and simple as all these online articles i've read about it
> claim?

I moved from a single server to a load-balanced setup with 2 back-end serve=
rs. I switched to a database-based session handler very similar to the one =
under discussion (just tailored to my house style, really) and it just work=
ed. Been running happily in production for about 6 months now.


Cheers!

Mike
--=20
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,=20
Woodhouse Lane, LEEDS,=A0 LS1 3HE,=A0 United Kingdom=20
Email: m.ford@leedsmet.ac.uk=20
Tel: +44 113 812 4730




To view the terms under which this email is distributed, please go to http:=
//disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: mysql user session handler

am 09.09.2009 15:30:48 von Tom Worster

On 9/9/09 4:16 AM, "Ford, Mike" wrote:

>> -----Original Message-----
>> From: Tom Worster [mailto:fsb@thefsb.org]
>> Sent: 09 September 2009 02:29
>>
>> thanks, Devendra, that's pretty much the same as my handler. (though
>> i can't
>> figure Rich Smith's $sess_save_path global. do you know what is
>> for?)
>
> I think if you look at the comments on that article, he's agreed that's an
> error and shouldn't be there.

i didn't read any of the comments, thanks for pointing it out.

while we're looking at mr. smith's article...

"Depending on how your code is structured, PHP does not always automatically
save any session data. To be certain you are retaining your session data
all the time, be sure to call the session_write_close() function at the end
of each page."

what are the specific conditions under which php _does_not_ write session
data when a script terminate?

according to the php manual,
http://www.php.net/manual/en/function.session-write-close.ph p
session_write_close() allows a script to release its lock on the session
allowing other scripts to use it. it implies you wouldn't "usually" use it
otherwise.


>> but what i'm really interested in is people's experience in
>> switching over
>> to and using this kind of handler: pitfalls, gotchas, etc. or is it
>> really
>> as easy and simple as all these online articles i've read about it
>> claim?
>
> I moved from a single server to a load-balanced setup with 2 back-end servers.
> I switched to a database-based session handler very similar to the one under
> discussion (just tailored to my house style, really) and it just worked. Been
> running happily in production for about 6 months now.

thanks for the info.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: mysql user session handler

am 09.09.2009 16:14:28 von Tom Worster

good point, gabriel.

i really need to stop procrastinating with the whole memcache project.
perhaps i ought to postpone consideration of the session handler until i've
learned something about memcache, which i need to do anyway.


On 9/8/09 10:06 PM, "Gabriel Sosa" wrote:

> I'm our case we opt for memcache to store the sessions
> Mmc its soo much faster and you will have less net overhead because
> the simple protocol
> Also the configuration its easier. If you see in the php manual you
> only need to touch two lines in the php.ini
>
> On 9/8/09, Tom Worster wrote:
>> thanks, Devendra, that's pretty much the same as my handler. (though i can't
>> figure Rich Smith's $sess_save_path global. do you know what is for?)
>>
>> but what i'm really interested in is people's experience in switching over
>> to and using this kind of handler: pitfalls, gotchas, etc. or is it really
>> as easy and simple as all these online articles i've read about it claim?
>>
>> or is that experience so hard won that people aren't keen to share it?
>>
>> -tom
>>
>> On 9/8/09 2:23 PM, "Devendra Jadhav" wrote:
>>
>>> http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Dat abase/
>>>
>>>
>>> On Tue, Sep 8, 2009 at 10:53 PM, Tom Worster wrote:
>>>
>>>> questions for those of you with a user session handler using mysql:
>>>>
>>>> did you write your own handler, write one based off some other you found
>>>> (if
>>>> so, which?), or are you using some available library (if so, which?)?
>>>>
>>>> and how do you feel about your implementation? satisfied? or are there
>>>> improvements you'd like to have?
>>>>
>>>> and what serializer do you use?
>>>>
>>>> i have my own set of handler functions (less than 70 loc) which seem to
>>>> work
>>>> in simple testing. but, while i'd really like to have the sessions in the
>>>> db
>>>> for redundancy, i haven't had the courage to deploy it yet. i derived the
>>>> code from something i found on the web. i trust everything i read on the
>>>> internet ;-)
>>>>
>>>> -tom
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php