Zend Framework memcache session save handler and using existing session

1.9k views Asked by At

I've got a legacy PHP application on a main domain which uses memcache as a backend for our sessions. This works great. I'm trying to add a new Zend Framework application on a subdomain that can share the same sessions that get created on the main domain.

I have the session and the savehandler configured in my application.ini:

resources.session.saveHandler.class = "App_Session_SaveHandler_Cache"
resources.session.saveHandler.options.type = "Libmemcached"
resources.session.saveHandler.options.maxlifetime = 300
resources.session.saveHandler.options.front.lifetime = 300
resources.session.saveHandler.options.front.automatic_serialization = true
resources.session.saveHandler.options.back.servers.0.host = "127.0.0.1"
resources.session.saveHandler.options.back.servers.0.port = 11211
resources.session.saveHandler.options.back.servers.0.persistent = true
resources.session.saveHandler.options.back.servers.0.status = true
resources.session.saveHandler.options.back.servers.1.host = "127.0.0.2"
resources.session.saveHandler.options.back.servers.1.port = 11211
resources.session.saveHandler.options.back.servers.1.persistent = true
resources.session.saveHandler.options.back.servers.1.status = true

The session save handler class (App_Session_SaveHanlder_Cache implements Zend_Session_SaveHandler_Interface and uses Zend_Cache factory passing in the Libmemcached option for the backend storage.

In my bootstrap, I have an _init method listed as the first method which calls the session bootstrap:

protected function _initForceSession()
{   
    $this->bootstrap('session');
    Zend_Session::start();
}

I want to be able to continue using an existing session from the main domain in my subdomain if it exists and create a new session if there isn't one there yet.

I'm able to successfully read in the session id in my new application that was created in the legacy application. However, I can't get the new application to actually read in the session itself.

I tried a direct read of memcache from the new application (bypassing the session) and I'm able to grab the session data that way.

What am I missing here?

0

There are 0 answers