hi, 2009/12/18 Daniel Pittman <[email protected]>: > justin randell <[email protected]> writes: >> 2009/12/17 Daniel Pittman <[email protected]>: >>> >>> Use session affinity in your load balancer. No, really, with PHP it will >>> almost certainly hurt less. Sorry. >> >> i'm interested in the war-wounds that made you write that ;-) > > Perhaps I should confess to being semi-ignorant about PHP: it could well be > that this was always easy, and I only found bad documentation about how to get > it working. > > Way back when, during the days that PHP4 was still a going concern, and PHP5 > pretty new, the best mechanism we could find for doing sessions not-on-disk > with PHP5 was to add a bunch of custom code to each application. > > Given we had a pool of something like six custom applications, two commercial > and obfuscated with some PHP source-code-encrypted widget, the overhead of > maintaining custom changes to the PHP code for each application was too high > for either my tastes, or my client. > > As far as I could tell it wasn't possible to just change, say, PHP.ini and > have it take care of storing all session data in the database using the > standard mechanisms. > > So, there you have it: possibly poor choice of PHP applications, not written > by us, made life painful. :) > >> having setup share-nothing php-heads writing session data to a database on >> several load-balanced architectures without any issues (directly related to >> that technique, of course), that response seems a bit blanket. > > It probably was, even if I noted later that things may have improved since > I had my painful times. :) > > Anyway, I am curious to know if that is still true: if I can't modify the PHP > code, can I store sessions in a database these days?
ah, now i see what you mean. yes, its still true, unless you install a php C extension that defines a session.save_handler for you to write session info to a database, then you need php code. a simple, per-application way to do this is to set auto_prepend_file to a file with db-backed session handler functions and a call to session_set_save_handler(). cheers justin -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
