PHP Session Resetting?

I have a “config.php” file that is included in the head of all my scripts. Within this contains the session_start() function.

Once a user logs in, all the session vars are set, but no matter what is clicked after that (even just refreshing the same page) the session is reset and all my session vars are lost.

As anyone ever run across this problem? Is there some kind of cron going that might affect this?

Also, I turned off cookies and made sure the server time was correct, as well as made sure there were no “refresh times” in the html head.

PHP has a couple options controling sessions. Between session cookies, rewrites, etc… there is a lot.

If you create a PHP page that just contains

<?php phpinfo(); ?>

we can see what PHP should be up to. Then it might become clear what the problem is.

PHP Session Settings

Figured it out. Apparently, in the php settings “session.use_trans_sid” was set to 0. Needed to be set to 1. :rolleyes:

Yeah. But that is only if you have session cookies disabled, or the user isn’t accepting them :slight_smile:

Correct Settings?

These are the current settings. Are they correct? I just dont want to have to manually pass the session id and I would prefer for the session id not to show up in the query string.

session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid On On

Thats the best way, yes. Cookies are perfered, but you will likley need the session ID in the query string at least once, which is why you need trans_sid.