Confused by PHP session problem (Rackspace)

2019-07-13 12:47发布

问题:

My PHP session fluctuates between different values for no apparent reason. here is my test code that proves it:

<?php
//test.php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);

session_start();

print_r($_SESSION);

?>

When I refresh that test.php, the $_SESSION has different values (about 3 different arrays in total), as if I was browsing the site in between refreshing the page (I'm not).

Echo'ing session_id() doesn't output anything.

Any ideas? This is completely messing up my handling of sessions/authentication throughout my site.

Update: I'm using RackSpace Cloud Sites for hosting

回答1:

Rackspace requires a different PHP session handler: http://www.rackspace.com/knowledge_center/article/php-sessions-state-servers-on-cloud-sites-and-how-to-fix-non-working-php-sessions