We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6366
    • 54 Posts
    Hello all,

    I have some problem :
    MODx is installed for site: http://www.site.com , it works just fine , I use in one of my snippet calls :

    $_SESSION[’variable_name’] = $variable;
    The session variable is stored in some
    /var/lib/php/session/sess_[+serial_here+]
    file.
    I can read this variable later, etc . OK.

    When I open site as just : http://site.com something unexpected is with sessions.
    I cant read variable, and what is weird - I see in /var/lib/php/session/
    two session files one is empty :
    /var/lib/php/session/sess_[+serial1_here+]
    one is with my variable:
    /var/lib/php/session/sess_[+serial2_here+]

    My browser cookie has referred to empty session id ( serial1_here )
    So I cant get variable name from $_SESSION[’array’], but MODx continues work smiley

    What is wrong and how to solve this problem ?
    Thanks,
    Dmitry


    web server is APACHE 2.2.0
    php 5.1.2
    MODX - 0.9.6-RC3






      • 6366
      • 54 Posts
      hi !
      so , if here is no quick answer for this problem, could you please advise me: which file ( module ) is responsible to set session coockies in CMS ?
      I think bug is in session set - sessions should be set for .site.name.com not for www.site.name.com .


      thanks , Dmitry
        • 22303 MODX Staff
        • 10,725 Posts
        Each of those URLs will maintain it’s own session. You can have completely different user sessions active, one via the www-prefixed domain and one via the non-www domain. Are you expecting sessions from both to be accessible from both? If so, for now you can try and hardcode the URL you want as your site_url, or within the setcookie call in startCMSSession() function in manager/includes/config.inc.php file. Alternatively (and more SEO-correct) would be to force all requests to one or the other (i.e. all go to www or non-www)...

        The next major release (MODx 0.9.7) will feature new session-handling settings available in the manager, the ability to provide a custom session handler class, and a default session handler class that uses a database table to manage user sessions more securely and with additional flexibility. At that point, you’ll be able to modify, replace, or, fine-tune MODx session behavior to whatever degree you need to.
          • 6366
          • 54 Posts
          Thanks, I found that one of my image has hardcoded absolute URL like http://www.site.com
          That is why I see two sessions ( one is empty )