Yii session do not work in multi server

前端 未结 2 1738
醉酒成梦
醉酒成梦 2020-12-17 05:54

I have 1 load balancing server and 2 web servers: Server1 and Server2. Both of them connect with DB Server. My problem: I am using Yii session to control session. After I lo

2条回答
  •  旧时难觅i
    2020-12-17 06:24

    A few other thoughts in addition to Charles' comments.

    1) You can use CDbHttpSession instead of getting a memcached server setup separately. This will store your session in your DB server behind your web servers.

    2) Do you have Suhosin enabled for your servers? If you do, it will cause many headaches, as Suhosin encrypts your session variables (and will do it differently on each server), causing your sessions to not be shared between servers.

    Good luck and come back with more questions if you have them. Shifting to a load balancer took us a while as we worked through the bugs.

提交回复
热议问题