I am currently trying run one of my old website on newly launched Windows server. We are using IIS 8.5, but I have struggles with correct settings of Session for PHP. On the server are runnig two versions of PHP, 5.4.9 and 5.6.2. For both of them I set session.save_path on “C:\inetpub\temp\sessions”. For this folder I set access rigths (write, delete, run, create) for user groups IUSR, IIS_IUSRS and Users. What is the problem, that I have all the time some issues with starting or cleaning session. Randomly I am getting some errors or warnings. One last of them was this one:
Warning: session_regenerate_id(): Session object destruction failed
This warning is quiet often. I have managed to run the website, but when I tried to log in to the system, nothing happend. Right after login it redirected me back on a login page, because it wasn't able to find and check user session. Additionaly I was trying to dump some data and I am getting this error:
Cannot regenerate session ID after HTTP headers have been sent.
So I am guessing, that the main problem is with session and it is not set correctly. Can you give me some advice, how to set it right? Or what could I have done wrong? Thanks
EDIT:
I just find out , that in process of login is my session empty. I try to login, script authenticate my account and save Identity into session. But when it redirects to another page after login, the session is empty and ther is no user identity.
What is important to say, this website was moved from Linux server and it was working right. So there is no problem in code. THere has to be some problem in settings of PHP or anything else.
For this Error:
Cannot regenerate session ID after HTTP headers have been sent.
Start your header or In the most Top of your code by this line:
<?php ob_start(); ?>
For this one:
Warning: session_regenerate_id(): Session object destruction failed
Could you post your full session code ? To check which line changes the session id then, your system cannot find the session you try to destroy