PHP Sessions suddenly not working
- by styrken
Out of no where my php sessions does not work anymore. The server have been running fine for several months.
I'am running Ubuntu 11.10 (GNU/Linux 3.0.0-14-server x86_64) with nginx/1.0.11 and php 5.3.19-1~dotdeb.0
Session info copied from phpinfo()
Session Support enabled
Registered save handlers files user memcached
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 0 0
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0
I have setup the following php script to test with:
error_reporting(E_ALL);
ini_set('display_errors', true);
error_log($_SERVER['REMOTE_ADDR'] . ' visited test page');
if(session_start())
echo "Session started <br />";
else
echo "Session failed <br />";
echo '<a href="?', time(), '">refresh</a>', "\n";
echo '<pre>';
echo 'session id: ', session_id(), "\n";
$sessionfile = ini_get('session.save_path') . '/' . 'sess_'.session_id();
echo 'session file: ', $sessionfile, ' ';
if ( file_exists($sessionfile) ) {
echo 'size: ', filesize($sessionfile), "\n";
echo '# ', file_get_contents($sessionfile), ' #';
}
else {
echo ' does not exist';
}
echo PHP_EOL;
$_SESSION['number'] = (int) @$_SESSION['number'] + 1;
var_dump($_SESSION);
echo "</pre>\n";
session_write_close();
echo 'done.';
It tells me that the session file exists, but my session id changes on each refresh..
What is going wrong? There is no output to any error logs at all.. :/
Please help!