My first post here, but I've been reading thread on here for quite a while now. I've run into a stupid problem which is probably quite simple to solve but so far I've had no luck with it (been searching all day
Basically I'm having trouble with sessions across subdomains on the live site (it works fine on my dev server). I cannot get the sessions to stick across sub domains whatever I try!
I even created a separate simplified test to see if it was my actual script causing the problem but apparently it's not.
Here's the code I've tested successfully on my dev server which won't work on the production one:
http://www.local.lh/startSession.php: (I've set this to replace the usual http://localhost)
Code: Select all
<?php
session_set_cookie_params(3600, '/', '.local.lh');
session_start();
$_SESSION['test'] = 'Working?';
?>http://sub.local.lh/showSession.php:
Code: Select all
<?php
session_start();
print_r($_SESSION);
?>I've checked all the session settings with phpinfo(); and the only differences are:
- session.gc_probability 1 on server (0 on local)
- session.save_path no value on server (/var/lib/php5 on local)
I'd really appreciate some help if anyone has any ideas. If you need more details just ask!
Thanks in advance,
Ben