Question

I have two Yii Applications that are both using the same Database. I recently connected the two of them matching both Yii applications config file:

return array(
'id' => 'PROJECT',
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'project',

'components'=>array(
    'user'=>array(
        // enable cookie-based authentication
        'allowAutoLogin'=>true,
        'class'=>'WebUser',

    ),
    'session'=> array(
        'timeout'=> 1440
    ),
    'partyroles'=>array(
        // enable cookie-based authentication
        'class'=>'WebUser',
    ),

Both applications have the same configuration as mentioned above. The purpose of connecting the two applications is to enable continuous activity between the two. For example, when a user logs into app1, he can access app2 without logging in and vice versa.

Problem is that it's unstable. Sometimes it doesn't work on other machines. Sometimes a user logs into app1 and cannot access app2 but when they access app2, they can access app1. What's the problem here?

UPDATE

Here is how I use CdbHttpSession to store sessions inside my database:

'session'=>array(
                    'class'=>'CDbHttpSession',
                    'connectionID'=>'db',
                    'sessionTableName'=>'YiiSession',
                    'timeout' => 1440
            ),

My table called YiiSession on the other hand stores the following data whenever a user logs in:

enter image description here

UPDATE

Just to clear things out, these two applications are under one domain and server.

No correct solution

OTHER TIPS

Sounds like session issues. Are your two Yii apps on the same physical web server or are they different servers? How do you store session information? On the hard drive? In a database?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top