Problems with session_start () in the Safari browser

2

I'm using the Safari browser, and I'm programming in PHP 5.5. inexplicably the safari does not secure session ... in fact neither creates!

In other browsers my system works correctly, only in Safari has this problem ... I would like to know if it is any configuration in my browser, or if it is something I have to configure in PHP 5.5 or if it is something else which is going unnoticed to me

Basically the only thing I use is:

session_start();

At the beginning of each file that uses the PHP session

In the body of the page index.html I use frames to mount my page, something like:

    <frameset>
    <frame src="topo.html"/>
    <frameset id="fraCorpo" ">
        <frame src="menu.html"  />
        <frame src="corpo.html"  />
    </frameset>
</frameset>
    
asked by anonymous 19.08.2014 / 18:20

2 answers

4

As already mentioned in the comments, first of all your browser must accept cookies .

Once this is certified, consider that if you are going to use the session between the various frames, there is a great chance that it will not work properly in any browser on the first page load, especially if you are going to session in one of the frames. p>

It may even work well in some special condition, but as a coincidence, since the propagation of the session between the framens depends on the order of loading of each element. It may well happen that the cookie is set to one of the frames, but the other's load already has started without receiving the cookie value, so its script no longer will have access to the created session. Worse still: you may be creating a new one, which overrides the cookie or is overwritten.

In this case a possible path is to create the session in the frameset and include the session ID in the frame URL, for example <frame src="corpo.html?SID=..."> , remembering to adjust the variables for your specific case.

    
19.08.2014 / 20:57
2

Sessions in php use a Session Cookie, so check the following:

  • Is your Safari allowing cookies? by default the Session Cookie is called "phpsessionid"
  • Are you sure you've used session_start() ? (it would be interesting to also use a session_name() )

I hope I have helped

    
19.08.2014 / 20:49