Session data not being passed?

Could I get some help as to why session variable information is not being passed?

This is just a simple log in script that I’ve used dozens of times, but I’m working with a new hosting server and things are being jacked up.

After I’ve checked the db for user info (login and password) I start my session and create a session variable to tell my authentication script that the user is logged in (setting $_SESSION[‘logged_in’] to true).

session_start();
$_SESSION['logged_in'] = TRUE;
while($row = mysql_fetch_assoc($result))
	{
		$id = $row['id'];
	}
$_SESSION['id'] = $id;
header('Location: /admin');

I’m including this authentication in all my scripts.

session_start();
if($_SESSION['logged_in'] !== TRUE) {
	session_destroy();
	header('Location: login.php');
}else{
$uID = $_SESSION['id'];
}
ini_set('session.bug_compat_42',0);
ini_set('session.bug_compat_warn',0);

This works fine on my local machine (MAMP). However, on the production server, $_SESSION[‘logged_in’] is not set (or something because it’s not equal to true when I test it).

I should clarify. When testing the login script, the session variable does get set to true. After it forwards to the index page, it’s reset, or lost, or whatever it is that happens to it.

Could I get some help on resolving this please? Thanks in advance.

Thanks for the reply Dan. I ended up using session_save_path() to declare my own directory…works now.

I couldn’t even find ‘/var/php_sessions’ but that just may be out of my permissible FTP access.

Are you sure it ever saved it? Check permissions on /var/php_sessions, see if there are actually files there, that your server isn’t out of disk space on that partition, etc.

And I see this error:

Warning: session_start() [function.session-start]: open(/var/php_sessions/sess_018f62a492fd7b0b0090e456abb304b5, O_RDWR) failed: No such file or directory (2) in /hermes/web08/b761/as.jensensliquors/public_html/admin/incs/auth.php on line 5

How is it that it saves the session data to a file but is unable to open or find that file in subsequent requests?