Yes, session files are being created properly. I was able to open and read both of them (one was created for each page). I replaced my actual domain name in the text above with mydomain for privacy.
Main Topics
Browse All TopicsI just moved my site to a Linux VPS and am having an issue with Session variables. Session vars are not getting passed from page to page. I used the following simple test to check the setup:
FIRST PAGE:
<?php session_start();
$_SESSION['userid'] = "foo";
print "Session id is: " . session_id() . $_SESSION['userid'];
print "<a href=secondpage.php'> go to next page </a>";
?>
SECOND PAGE:
<?php session_start();
print "Welcome" . $_SESSION['userid'] . "<br />";
print "You have got to page 2 with these information stored in the session: " . $_SESSION['userid'] . " and your session is still: " ;
echo session_id();
?>
When testing this, I get a different Session ID on the second page and no 'userid' printed.
I have made several changes to my php.ini file including:
1. enabled register_globals
2. set session.save_path and confirmed the path exists and is writable
Here is my php.ini Session info:
Session Support enabled
Registered save handlers files user mm
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
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 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /home/mydomain/tmp/session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off
I'm not sure what else I could be missing.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Found the problem.
My link to the second page was going to http://domainname.com/seco
Was about to say this is most likley a cookie problem :)
You should be able to modify the config to allow PHP to issue a wildcard cookie so the cookie will propergate between *.domain.com
edit the session.cookie_domain in php.ini from the default of “” to “.domain.com”
If you have more than one domain you should be able to get away with using
session_set_cookie_params(
to specify the domain explicitly.
Business Accounts
Answer for Membership
by: TrakosPosted on 2007-03-03 at 13:42:05ID: 18648330
Have you checked whether session files are saved (and have proper chmods) in session.save_path ? (in your cfg it is /home/mydomain/tmp/session _files )