1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

PHP cookie across domain and subdomain

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by PlymWS, Aug 26, 2011.

  1. PlymWS

    PlymWS Guest

    0
     
    Hi,

    I have Plesk 9.3 on a new server. I have a domian (domin.com) setup and a subdomain (sub.domain.com) setup as another domain rather than as a subdomain of the original. This allows me to specify a separate IP address for the subdomain and use 2 SSL certificates, one for the domain, one for the sub domain.

    I am unable to use the sub.domain.com sookie to verify a session from domain.com Both domains are hosted on the same server and write their files to the same place.

    I have tried chmod 777 the session files because the domains are controlled by a different user due to Plesk restrictions but this doesn't help.

    I have also tried setting the session domain in php.ini as .domain.com but this also doesn;t help.

    Anything else I can try ?
     
  2. PlymWS

    PlymWS Guest

    0
     
    Anyone ???
     
  3. PaulC

    PaulC Regular Pleskian

    24
    57%
    Joined:
    Aug 5, 2001
    Messages:
    192
    Likes Received:
    0
    The issue you describe is not specific to Plesk - cookies cannot be accessed across domains.

    In PHP you should be able to set the cookie with the domain in the form of ".domain.com" and this will allow the main site, and subdomains to access the cookie.

    There is a section on the PHP site relating to this, specifically a section relating to setting the domain:

    http://php.net/manual/en/function.setcookie.php

    Paul
     
  4. PaulC

    PaulC Regular Pleskian

    24
    57%
    Joined:
    Aug 5, 2001
    Messages:
    192
    Likes Received:
    0
  5. javismiles

    javismiles New Pleskian

    6
    70%
    Joined:
    Mar 21, 2014
    Messages:
    9
    Likes Received:
    0
    i have a similar issue and i would say it is related to plesk,
    This code

    <?php
    ini_set('session.cookie_domain', '.domain.com' );
    $some_name = session_name("domain");
    session_set_cookie_params(0, '/', '.domain.com');
    session_start();

    makes problems go away in servers with no plesk,
    but problem remains in server with plesk

    surprise!

    so please what is wrong in plesk configuration to interfere with session communication between subdomain and domain?

    thank you
     
Loading...