Grow your CSS skills. Land your dream job.

Pass php sessions to subdomains

  • # July 18, 2012 at 6:57 pm

    I have found a couple of answers, some need cookies some don’t. I don’t want cookies. Also the other answers needed access to the php.ini which in my case and many others is restricted. So I’m just wondering: Is there any way I can pass php sessions (php_session()) over subdomains without using cookies OR php.ini? I honestly don’t think so, but if there is please comment below

    Thank you.
    – Schart

    # July 18, 2012 at 7:11 pm

    Even setting a cookie wouldn’t work unless you modified the php.ini file as security measures built into browsers and the PHP core forbid the access of both sessions and cookies that aren’t the same domain as the origin, one thing people are suggesting which i think is risky is saving the session to a database which both domains have access to and redirect the user with a session id as part of the query string in the URL and update the session_id on the new domain.

    Personally i feel there is a lot of room for things to go wrong doing it that way so i wouldn’t recommend even trying it but it’s up to you whether you want to or not, apart from that editing your php.ini file is the most assured way to go about doing this.

    # July 18, 2012 at 7:13 pm

    Hmm.. Okay. I could see one way going OK though, maybe passing a form submission as a “link” to the subdomain, giving it information. This would only work from that “link” though.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".