Problems with session_start() in Safari browser

Asked

Viewed 363 times

2

I am using the Safari browser, and am programming in PHP 5.5. inexplicably safari does not secure session... nor actually creates!

In other browsers my system works correctly, only in Safari has this problem... I wonder if it is some configuration in my browser, or if it is something I have to configure in PHP 5.5 or if it is something else that is passing me unnoticed

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 index.html page 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>
  • Are you sure it is not blocked in some way the creation of cookies. Because sessions are usually supported on the use of cookie. Take a look if any extension, plugin or setting is not blocking.

  • The browser Safari is clean of extensions, I installed it a couple of weeks ago, and only for testing here in the company.......

  • Hello consider checking cookies, http://www.timeanddate.com/custom/cookiessafari.html. If you can post the code, it would be good.

  • updated above the code I use

  • 1

    Remember that if you are going to use the session between the various frames, there is a good chance that it will not work right in any browser on the first page load, especially if you arrow the session in one of the frames. There it may work well, but as a coincidence (because it depends on the order of load of each element the initial propagation of the session by cookies). In this case a possible path is to create the session in Frameset and include the session ID in the frame URL, for example <frame src="corpo.html?SID=...">.

  • As @Bacco commented, probably the problem lies in the fact of loading your site in frames, which is not recommended nowadays.

Show 1 more comment

2 answers

4


As already stated in the comments, first of all it is necessary that your browser is accepting cookies.

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

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

In this case a possible path is to create the session in 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.

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 used the session_start()? (it would be interesting to use also a session_name())

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.