You are here: Re: Falling back to PHP's session handler « PHP Programming Language « IT news, forums, messages
Re: Falling back to PHP's session handler

Posted by Chung Leong on 03/14/06 18:52

usenet@shat.net wrote:
> Hi all,
>
> I've created a custom session handler that saves session data to a
> MySQL database. If the database server is down, I'd like to fallback to
> PHP's default session handler (files) until the server comes back up.
>
> After calling session_set_save_handler(), is there a way to tell PHP to
> ignore this setting and revert to temp files for session storage? If I
> try an ini_set on session.save_handler upon detecting that the DB
> server is down, it doesn't work because the session is already active.
>
> Thanks

Try shutting down the session by calling session_write_close() before
you call ini_set(). The update handler on session.save_handler checks
the session status. Resetting the status to inactive should allow you
to have the handler back to "files."

I wonder how well such a fallback mechanism would work. Active sessions
at the moment when the database goes down would be lost. The same thing
would happen when the database comes back online as the session files
are now ignored.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация