PHPSESSID Keeps Refreshing

Status
Not open for further replies.

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
Hi all,
I have found that my PHPSESSID keeps refreshing.
For example, my PHPSESSID value could start at f3e5d9f7580415f6f33e8168baebacd8, then, when I reload the page it changes to 51650bc39fa118082101a7ec56303ecd.
This is an issue, as I cannot save anything to the user's session.
I have tried to change the session save path. Viewing the sessions folder I created, I can see the server creating multiple sessions for each refresh.
Is there an easy way to fix this?
Thank you,
Josiah
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
I have tested this on my server using $_SESSION. I have looked at the PHPSESSID cookie and it hasn't changed since a few refreshes (two to be exact, cache updates usually after two, for me anyway).
What server are you on? Also, what browser and operating system?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
@caftpx10 ,
I have tested it in Chrome on Chrome OS, Android, & IOS.
I am on server xo3.
Thank you,
Josiah
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Are you destroying your sessions/cookies on page load?
I can try to create a simple script that may help identify the problem. I'm on Xo2 so I don't know if the script would revile enough on Xo3.
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
@caftpx10 ,
I don't think I am destroying them on page load. The only place I "unset" them is in the logout class.
Here is what I do at the top of each page to set up the sessions:

session_save_path("/home/mirrgx10/sessions/"); //To set a new session save path (to see what was being written). This folder is chmod 777.
ini_set('session.cookie_domain', '.[domain].x10.mx' ); //To make the sessions work on all subdomains.
session_start(); //To start sessions

The weird thing is that the last two lines worked just fine by themselves a month or two ago (I added the top line to try to solve my problem).
Let me know if you have any ideas!
Thanks,
Josiah
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Have you tried using the "normal" path within the session_save_path() function?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
@caftpx10 ,
Do you mean "/tmp" or just session_save_path() (with no parameter)?
If it helps, here is my phpinfo page: mirrg[dot]x10<dot>mx[slash]mirrgmin<slash>phpinfo.php
Thanks,
Josiah
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
@caftpx10 ,
Do you mean "/tmp" or just session_save_path() (with no parameter)?
If it helps, here is my phpinfo page: mirrg[dot]x10<dot>mx[slash]mirrgmin<slash>phpinfo.php
Thanks,
Josiah
Is the '/sessions' part of the parameter to do with storing a list of sessions in a directory called 'sessions'?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
Is the '/sessions' part of the parameter to do with storing a list of sessions in a directory called 'sessions'?
Yes. That directory is chmod 777. I am seeing multiple sessions created in that directory each time I refresh the page.
You can see my situation if you look at the PHPSESSID cookie on the phpinfo page and then refresh the page.
Does this information help?
Thanks,
Josiah
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Yes. That directory is chmod 777. I am seeing multiple sessions created in that directory each time I refresh the page.
You can see my situation if you look at the PHPSESSID cookie on the phpinfo page and then refresh the page.
Does this information help?
Thanks,
Josiah
Try directly pointing to the folder by using..:
PHP:
session_save_path('/sessions');
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
Try directly pointing to the folder by using..:
PHP:
session_save_path('/sessions');
Trying that yields: "session_start(): open(/sessions/sess_5ea668010100bface7e9bf3ee952f27e, O_RDWR) failed: No such file or directory".
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Trying that yields: "session_start(): open(/sessions/sess_5ea668010100bface7e9bf3ee952f27e, O_RDWR) failed: No such file or directory".
I'm not so clear on what session_save_path() is about and why would you need to use it exactly. Is it for logging sessions into a file or something?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
I'm not so clear on what session_save_path() is about and why would you need to use it exactly. Is it for logging sessions into a file or something?
I was using it to try to fix my problem (it changes the server-side sessions folder). I'll comment it out.
Sadly, the issue is still present though.
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
I was using it to try to fix my problem (it changes the server-side sessions folder). I'll comment it out.
Sadly, the issue is still present though.
Is there any other PHP code which involves the sessions or/and cookies?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
Is there any other PHP code which involves the sessions or/and cookies?
The only other code I can think of is in the logout file and the accounts class. Both of which are not run unless the user visits the logout page.
Thanks for the suggestion! Any other ideas?
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
The only other code I can think of is in the logout file and the accounts class. Both of which are not run unless the user visits the logout page.
Thanks for the suggestion! Any other ideas?
As I don't have the full code right in my face, I'm not sure if this is a server or code issue. It does seem very abnormal for the PHPSESSID to change on refresh.
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
As I don't have the full code right in my face, I'm not sure if this is a server or code issue. It does seem very abnormal for the PHPSESSID to change on refresh.
Do you have a script I could try?
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
So, after trying a few different things out, here is what I have found:
  1. Delete all site cookies.
  2. Use: "ini_set('session.cookie_domain', '.[domain].x10.mx' );".
  3. Refresh the page.
  4. Comment out the above line (step 2).
  5. Refresh the page.
This seems to work. It creates two PHPSESSID cookies. One for .[domain].x10.mx and one for [domain].x10.mx.
It also seems to not refresh the first session that was set (the second session still refreshes with each reload). For example, if I do the above process, the PHPSESSID for .[domain].x10.mx will not change, meaning I can store values in it.
I still don't know why setting one session doesn't work as it did before.

I hope this helps solve the problem!
Thank you,
Josiah
 
Status
Not open for further replies.
Top