Sharing a session between Ruby and PHP

后端 未结 2 1357
死守一世寂寞
死守一世寂寞 2021-01-12 17:57

Is it possible to share a session between my PHP app on a subdomain and my Ruby apps on my other subdomains?

I don\'t really know where to take it from here. I know

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 18:13

    If you want to share sessions in that manner (accross PHP/Java/Ruby/etc), you need to save sessions (and access them) from a Database.

    See: http://php.net/manual/en/function.session-set-save-handler.php

    And you would need an identical approach in Ruby.

    To share cookies across domains, you also need to change the PHP session configuration option for session.cookie_domain from the default of "" (which inserts your domain name) to: ".yourhost.com" (note the prefixed period).

提交回复
热议问题