Re: [PHP] Saving session to database

[email protected] (Andrew Ballard)
Newsgroups php.general
Message-ID <CAC1b6Rtt2dwX1474Zz3BAt_y+=9WteZ50qYzTQpY2Ak4haVYVw@mail.gmail.com>
I've found database session storage requires extra diligence in error
handling. When I see that error at 0 it is usually because something blew
up either before the session handler was ready or after it was torn down.

Andrew
On May 17, 2013 2:42 PM, "Matijn Woudt" <[email protected]> wrote:

> On Fri, May 17, 2013 at 8:07 PM, Lester Caine <[email protected]> wrote:
>
> > Matijn Woudt wrote:
> >
> >>
> >> It seems to me the session functions are failing, probably due to
> >> problems with
> >> the database. Have you checked that there actually is a ##session table
> >> in your
> >> database?
> >> You might want to add some debugging code to these functions, to check
> if
> >> errors
> >> occur with inserting or retrieving the sessions from the database.
> >>
> >
> > Well past that stage without making any progress.
> > Using the write function outside of the session_set_save_handler() it
> > works perfectly, and then the read can see the saved sessions and can
> load
> > them.
> >
> > I am convinced that something is wrong with the general setup which is
> > preventing the write and close from firing when it should. I can not
> trace
> > any attempt to call the write function in the session handling.
> >
> > I'm currently checking out the adodb-session handler which WAS working in
> > PHP5.3 but seems to be showing similar problems in PHP5.4
> >
> >
> Well, I'm not sure what would be the problem here, but some general
> comments:
> There have been various changes in session handling between 5.3 and 5.4, so
> most likely it is in there. Check if there are any references to
> register_shutdown_function, and replace them with
> session_register_shutdown.
> Second, check the return value of session_set_save_handler, it is a bad
> habit not checking return value of a function, just because it works.
> If that doesn't help, take the session piece out of the big framework, and
> test it in a separate file. If that also fails, you've got a small piece of
> code you can post here which will encourage others to have a look at it at
> their box.
>
> - Matijn
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.