I'm currently in the process of writing a PHP 'plug-in' that tracks sessions across unique domains. In order to do this, I've figured the best way to handle 'sessions' across different domains is to write my own Session class/library.
I've considered using session_set_save_handler()
which is normally an excellent way of doing this. However, I'm concerned that many of the web applications that this PHP plug-in will be installed on may already have their own usage of session_start()
and PHP sessions and I suspect it's likely that session_set_save_handler()
may break a few things - so I'm reluctant to use that.
Before I go about rewriting my own MySQL PDO-database session library, I'm wondering if there's anything like this already out there so I don't go about reinventing the wheel so to speak? I've had a quick look on Google and I can only see ones that use session_set_save_handler()
which is a no-no as I mentioned.
Here's a few that I've found already that I've ruled out:
PHP-MySQL-Session-Handler https://github.com/sprain/PHP-MySQL-Session-Handler
Rejected because it uses session_set_save_handler(..)
and hence will force the rest of the web application to save sessions to MySQL in the same way (which I don't want for the reasons outlined above.)
Zebra Session https://github.com/stefangabos/Zebra_Session
This looked promising but rejected because it also uses session_set_save_handler(..)
Thanks in advance.
Not without using session_set_save_handler
what I'm aware of. Session are handy, but getting there can a lot of pulled hair and wth-moments. session_set_save_handler
removes a lot of the hair pulling and flip-the-table tantrum.
Are you really really sure you need a your custom session library? Rewriting one from scratch when there is existing functionality sounds very much inventing the wheel again.