Hi all,
I have a strange problem. I have a login procedure that uses a mysql
database in which the users are stored.
The login procedure is pretty straightforward. In every page I unclude
my session.php.
session.php:
=============
session_start();
// if username and password were specified, fetch them
if (isset($HTTP_POST_VARS['username'])) $entered_username =
$HTTP_POST_VARS['username'];
if (isset($HTTP_POST_VARS['password'])) $entered_password =
$HTTP_POST_VARS['password'];
// check if login is neccesary
if (!isset($entered_username) && !isset($entered_password))
{
// use data from session
if (isset($_SESSION['username']))
{
$login = $_SESSION['username'];
$password = $_SESSION['password'];
}
else
{
// Display error cause we don't have a username
$_SESSION['message'] = $MsgErrAccessDenied;
require("./error.php");
exit;
}
}
else
{
// use entered data
// encrypt entered password
$login = $entered_username;
$password = md5($entered_password);
$_SESSION['username'] = $login;
$_SESSION['password'] = $password;
}
<More code>
============
On one server this works fine. On another one though the session
variables $_SESSION['username'] and $_SESSION['password'] aren't being
stored. I can tell by looking at the session_.... file in /tmp.
On the server where it works it contains the username and password
session vars, on the server where it doesn't work the file is being
created but it's empty. I checked php.ini, comparing the php.ini files
from both servers, especially the settings that have to do with
sessions. Both have the same session settings, but the problem still exists:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
System specs:
=============
Server that works : Solaris 8 intel, Apache 1.3.26, PHP 4.2.2
Server that doesn't work : Linux 2.4.16 (Sun Cobalt), Apache 1.3.20, PHP
4.0.6
Any ideas are welcome.
Kind regards,
Ruben.