Sharing session between applications

Hello all!

I am trying to share sessions between my yii applications. I already read couple of wiki and forum articles and I can’t get it to work.

This is my config file (same for all the apps)


'id' => 'application',

'user' => array(

            // enable cookie-based authentication

            'allowAutoLogin' => true,

            'loginUrl' => array('site/login'),

            'class' => 'MyWebUser',

            'identityCookie' => array(

                'domain' => '.ct.local'



        'session' => array(

            'savePath' => '/temp',

            'cookieMode' => 'allow',

            'cookieParams' => array(

                'path' => '/',

                'httpOnly' => true,

                'domain' => '.ct.local',



The /temp folder is accessible and writable. I also extended CWebUser as follow:


class MyWebUser extends CWebUser


    public $identityCookie = array(

        'path' => '/',

        'domain' => '.ct.local',



So basically when I authenticate on http://intranet.ct.local and go to forum.ct.local it emptys the session for some unknown reasons. Once done, when I hit refresh on the intranet I am not logged in anymore…

Could it be that the DNS entry are wrongly setup? I am really lost regarding this issue any help would be really appreciated.


OK my collegue found the issue. It was about Ubuntu and suhosin encrypt session.

What we did is disable the encryption in our .htaccess files (on both applications) like the following:

php_flag suhosin.session.encrypt off


Is not also possible to move the session storage into a shared database table.