SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,045
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    session.cookie_domain (question/problem)

    Hi Guys,

    I am trying to register my PHP session site-wide (all dirs and subdomains), but it does not seem to be working. Here is the scenario:

    1) The session is being registered from https://secure.mydomain.com/clients
    2) I also want the session to work in http://mydomain.com/domains

    I am using the following ini_set at the top of my file (before session_start()):

    PHP Code:
    ini_set('session.cookie_domain''.mydomain.com'); 
    I have also tried:

    PHP Code:
    ini_set('session.cookie_domain''mydomain.com'); 
    (without the .)

    Is this possible? Does it have anything to do with SSL?

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yes itís because of SSL, session and cookies created on https can not be access through http and visa versa.

    Cheers,
    Maneet Puri
    Lexolution IT Services

  3. #3
    SitePoint Evangelist
    Join Date
    May 2006
    Location
    Denmark
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to set session.cookie_secure to false. By the way, there is a function for this.


    Quote Originally Posted by maneetpuri View Post
    Yes itís because of SSL, session and cookies created on https can not be access through http and visa versa.
    Not entirely true. You cannot read cookies where secure=true on unencrypted connections, but you can read cookies where secure=false on both encrypted and unencrypted connections.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •