简体   繁体   中英

How to separate Cakephp session and Yii session

I have a Cakephp application and Yii application running on the same server. And their session config are

Cakephp:

Configure::write('Session', array(
        'defaults' => 'php',
        'ini' => array(
            'session.cookie_path' => '/cakephp_app',
        ),
        'cookie' => 'PHPSESSID'
));

Yii:

'session' => array(
        'autoStart' => true,
        'timeout' => 5400,
        'sessionName' => 'YIIAPP',
)

I supposed their session will be separated, but the result is negative.

Since the cakephp app is already in production, so what can I do to separate the Yii session from the cakephp session?

And can anyone tell me how come my Yii is still using the PHPSESSID session, rather than then 'YIIAPP' session?

I've tested this and adding:

'sessionName' => 'YiiAPP' 

worked first time for me.

However, I then added

session_start() 

To my index.php file - and this then shows the PHPSESSID. So I suspect somewhere in your code you are using session_start() - which Yii doesn't need. It starts its own session automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM