I haven't posted here in a while; it's good to be back, even if just for a brief amount of time.
I'm running the latest version of PHP (5.0.5) along with the latest version of Apache (2.0.4, I believe) on WinXP Pro. Try as I might, but PHP just isn't being my friend today. Everyime I reload a page, it creates a new file in my sessions directory. Which means that session variables being set in one page are not being read in another, which is a serious problem for my authenticating. Unfortunately I blew away half of my authentication script in an attempt to find the problem, but that's irrelevant. I've tried everything - chaning php.ini every way I know how from the experience I've attained, searching Google, looking at the PHP manual (and using the hint that someone else did to remedy this problem; nope, didn't help me) and even checked this board (yes, I noticed the thread about this back on the 25th of Dec. in the "Install" section; no, it doesn't help me out either). Here's a copy of my "sessions" info set in phpinfo(), if it helps. Please, if anyone knows of any remedies for this issue, please let me know ASAP!!!
Thanks!Well you need to have a C:\Temp directory, with wirte permissions for server. So your apache could write into this dir. If all ok - after each session creation, you will C there a NEW file, what name looks like sess_SESSION_ID. Also plz check up apache error logs, there you will find errors servers generetes while creating session.
Also you need to setup "set session use only cookies" to off, in other way your server will read session ID only from cookies, and if client don't have them enabled - sessions will not work.
And if all ok, you see new sess_ files in C:\Temp dir, sess only cookies disabled and in your apache logs nothing about errors, then give your scripts plz.I actually have a similar issue with my session class under PHP 5. I have narrowed it down to a session regeneration part, which I've just skipped for now in PHP 5. Though oddly enough, I cannot create a test case because the class works just fine in a simple test scenario, but in a more complex context, completely fails. However I am fairly sure I have found the problem code since removing it [the session regeneration part] makes sessions work fine in PHP 5.
Not sure if that helps you, but if your authentication script or anything else does anything with session regeneration, you might try taking that out and seeing if it works then.not sure, what you have under meaning of "session regeneration" - but anyway, if problem still exist, any source code is welcomeSession regeneration, any time there is a change in access level, it is good practice to give the user a new session id (and if you like destroy the old session at the same time). I should have been a bit more clear and said session id regeneration. Logan mentioned an authentication script, so that some session id regeneration is going on might a possibility.
I also just noticed in your session config, you have cookies required, and the cookie domain is localhost... some browsers will not accept cookies from "localhost". You might try 127.0.0.1 as the cookie domain instead and see if that helps.I'll try setting the cookie and working with these suggestions. Thanks for the help so far!
BTW, I know it's not a problem with my script because I created a very simple two-page script which is, literally, only the following lines:
test1.php
<?php
session_start();
$_SESSION['test'] = "testing";
echo $_SESSION['test'];
?>
---
test2.php
<?php
session_start();
echo $_SESSION['test'];
?>the problem might be because no "name" is being set for the sessions, and hence creating new sessions per request. before you do session_start() give it a name i.e. session_name('mySite'); and do this every time the session is started. this way you will keep the sessions unique and more manageable.
I'm running the latest version of PHP (5.0.5) along with the latest version of Apache (2.0.4, I believe) on WinXP Pro. Try as I might, but PHP just isn't being my friend today. Everyime I reload a page, it creates a new file in my sessions directory. Which means that session variables being set in one page are not being read in another, which is a serious problem for my authenticating. Unfortunately I blew away half of my authentication script in an attempt to find the problem, but that's irrelevant. I've tried everything - chaning php.ini every way I know how from the experience I've attained, searching Google, looking at the PHP manual (and using the hint that someone else did to remedy this problem; nope, didn't help me) and even checked this board (yes, I noticed the thread about this back on the 25th of Dec. in the "Install" section; no, it doesn't help me out either). Here's a copy of my "sessions" info set in phpinfo(), if it helps. Please, if anyone knows of any remedies for this issue, please let me know ASAP!!!
Thanks!Well you need to have a C:\Temp directory, with wirte permissions for server. So your apache could write into this dir. If all ok - after each session creation, you will C there a NEW file, what name looks like sess_SESSION_ID. Also plz check up apache error logs, there you will find errors servers generetes while creating session.
Also you need to setup "set session use only cookies" to off, in other way your server will read session ID only from cookies, and if client don't have them enabled - sessions will not work.
And if all ok, you see new sess_ files in C:\Temp dir, sess only cookies disabled and in your apache logs nothing about errors, then give your scripts plz.I actually have a similar issue with my session class under PHP 5. I have narrowed it down to a session regeneration part, which I've just skipped for now in PHP 5. Though oddly enough, I cannot create a test case because the class works just fine in a simple test scenario, but in a more complex context, completely fails. However I am fairly sure I have found the problem code since removing it [the session regeneration part] makes sessions work fine in PHP 5.
Not sure if that helps you, but if your authentication script or anything else does anything with session regeneration, you might try taking that out and seeing if it works then.not sure, what you have under meaning of "session regeneration" - but anyway, if problem still exist, any source code is welcomeSession regeneration, any time there is a change in access level, it is good practice to give the user a new session id (and if you like destroy the old session at the same time). I should have been a bit more clear and said session id regeneration. Logan mentioned an authentication script, so that some session id regeneration is going on might a possibility.
I also just noticed in your session config, you have cookies required, and the cookie domain is localhost... some browsers will not accept cookies from "localhost". You might try 127.0.0.1 as the cookie domain instead and see if that helps.I'll try setting the cookie and working with these suggestions. Thanks for the help so far!
BTW, I know it's not a problem with my script because I created a very simple two-page script which is, literally, only the following lines:
test1.php
<?php
session_start();
$_SESSION['test'] = "testing";
echo $_SESSION['test'];
?>
---
test2.php
<?php
session_start();
echo $_SESSION['test'];
?>the problem might be because no "name" is being set for the sessions, and hence creating new sessions per request. before you do session_start() give it a name i.e. session_name('mySite'); and do this every time the session is started. this way you will keep the sessions unique and more manageable.