There is a very strange issue with PHP session when you prefer session to save in files other than database (normal session).
The problem is: some times you can access all the saved session values from $_SESSION and sometimes it returns a empty array.
If you refresh 10 times, perhaps 4 times you will get session and 6 times you will get it empty.
The problem is not due to domain level security or session expiry . It is due to session file location. If you run a phpinfo() function in any of your page, you can see there is a part of sessions. There you can see a session variable *session_save_path *and it will be pointing to /tmp/ or /etc/somefolder or /var some folder inside the linux file architecture.
Since at clouds, different servers server at different time, some server can see the exact saved files in that location and some server cannot. (Since /tmp etc directories are not shared among them)
Solution: Call the below php function and set session file path inside your web root . You need to call this function before your session_start() call
For windows users as well, this is the solution. This problem occurs in ASP application as well.