Why does PHP not keep session between pages?

dymbobbyCycle

New Member
I have a Windows server 2008 with apache2. The server has 2 discs and I run an apache instance on both. The first runs as a service the second in the commandline. They both use an exact copy of an identical webroot in their own htdocs folder. Also they both use the same PHP install that is located on the first disc (Program Files (x86)). My application runs over SSL and uses PHP and MySQL.The webserver that runs as a service runs my application fine and lets me login and has my session data ready at all times. The second server however lets me run my login script, has session data while running the script but loses that session data after a redirect to another page inside the same webroot.The problem on the second webserver is similar to this question with the exception that I have session_start() on every page.My login script works like this:
  • User requests a page
  • If the user is not authenticated, he is thrown back to the login page
  • If the user is authenticated, he gets an $_SESSION["auth"] with his profile data
  • Then when the user is browsing the main page or other pages that need auth, they just check if the $_SESSION["auth"] is set.
Any tips on how to solve this? EDIT: A small clarification. I do have a session ID on each page. That id does not change when I get redirected. I do NOT have any data in the $_SESSION variable on the page I redirect to.
 
Back
Top