Strange session behavior.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hickscorp
Forum Newbie
Posts: 4
Joined: Sun Jun 08, 2008 5:16 am

Strange session behavior.

Post by hickscorp »

Hello people,

i have since this morning on my server a problem.
Each time i refresh a page which calls "session_start()", a new "sess_*" file is created in the server's /tmp folder, and it obviously avoids the session to be "stuck" to a cookie.

What can be wrong in my set up?
Thanks,
Pierre.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Strange session behavior.

Post by Ambush Commander »

Is your browser accepting session cookies? If you have a named session, have you called session_name()? What's the value of session_id() in your script?
hickscorp
Forum Newbie
Posts: 4
Joined: Sun Jun 08, 2008 5:16 am

Re: Strange session behavior.

Post by hickscorp »

My browser is accepting cookies, like the 3 others browsers i have tried on 2 different computers.
Session ID is unchanged (i think the default is PHPSESSID, set up in my /usr/local/lib/php.ini...
Also, i never call session_name in any of my scripts.

I have made several tries with / without overridding session ID and name, and the result is the same.

[EDIT] The strange thing is that it wasn't behaving like this yesterday... i'm wondering, can it be an O.S. related problem? i'm running apache 2.2.8 / php 5.2.6 both compiled from sources...[/EDIT]

Thanks for your help,
Pierre.
hickscorp
Forum Newbie
Posts: 4
Joined: Sun Jun 08, 2008 5:16 am

Re: Strange session behavior.

Post by hickscorp »

Up?...

i have reinstalled my whole system, becase my HDD was dead.
So new HDD, new apache / php compiled from source, same problem.
i have created a very basic test page Test.php, which only does "session_start();".
When i access the page, i see a file named "sess_92a1d5255e7d85e34a42aba4aa422f83" appearing in my /tmp.
If i just reload the page, another one is created, "sess_94cd5580871613484b5f78a2336451de"...

i have tried either with ini settings from php-recommended, php-dist and no php.ini...
I would really apperciate help on this please :)

Thanks,
Pierre.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Strange session behavior.

Post by Ambush Commander »

Out of curiosity: try modifying $_SESSION, and see if the change carries over. Other than that, I don't know why you're seeing this behavior. (Maybe PHP is supposed to work like that?)
hickscorp
Forum Newbie
Posts: 4
Joined: Sun Jun 08, 2008 5:16 am

Re: Strange session behavior.

Post by hickscorp »

When i set anything inside $_SESSION, the variable is obviously wrote thru the sess_* file. But since when i reload the page another file is created, $_SESSION is empty.
Post Reply