FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » database-based sessions for 3rd party php app
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: database-based sessions for 3rd party php app [message #179020 is a reply to message #179017] Wed, 05 September 2012 12:26 Go to previous messageGo to previous message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma:
Senior Member
On 9/5/2012 1:37 PM, The Natural Philosopher wrote:
> Axel wrote:
>> Hi readers,
>> I am currently trying to increase the performance of a 3rd party
>> learning platform web app we are (still) using. The current setup is
>> to store the PHP sessions on an NFS share, which I personally find
>> not-so-good.
>>
>> Now I don't want to touch the code of this app, for various reasons.
>> But I want database sessions.
>> Is there a good, proven and solid way to move the session management
>> to the database _without_ modyfying the app's code?
>>
>>
>
> How could there be?
>
> In order to write something into a *database* in preference to a file or
> directory, requires application level changes. Or an entire rewrite of
> part of PHP.
>
>


No, not in this case, TNP, at least it won't be anything rigorous.
Session handling can be changed for an existing application without
breaking it.

You have to do the following:
1) Change for this application the session storage
session_set_save_handler will take care of that.

The easiest way to do this is by adding a file of yourself somewhere
where you define the settings and call session_set_save_handler.
Maybe the existing application has a file that is included everywhere
(which is very common), then simply add you file to it (via another
include, use full path to your session-definition-file to avoid
complexities with include from other directories)

2) Write the appropriate functions you name in the above function

3) Of course, add a table to the database for storage.

There are a few examples on the net to be found to do this.

If memory serves me well, adodb abstraction layer has one ready-to-go
build in.

From the application point-of-view, there will be no change.

Good luck,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Net Connect API -php
Next Topic: Php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 05:27:37 GMT 2024

Total time taken to generate the page: 0.04384 seconds