Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session_id() returns "" [very impt!]

Status
Not open for further replies.

joeisbatman

Programmer
Oct 8, 2001
39
US
What POSSIBLE SCENARIO makes the session_id() function return null????

I have a website where <i>SOMETIMES</i> when you visit the main page, your session_id() is blank. This causes a problem, for it means that session_start() is not maintaining the session for subsequent pages.

The problem is fixed MOST OF THE TIME by just closing the browser and going back to the page. Any ideas on how I can avoid this????

Here is my php.ini settings for SESSIONS:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 2880
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
 
One addition...
My code looks like this: (someone please please please help. I'm dieing.)

<?php
session_start();
echo session_id();
?>

One comment that I should have mentioned in the origional post-- I've tested the webpage when the client has cookies both on and off. This fact should have nothing to do with the session_() returning &quot;&quot; because when cookies are off, the only difference is that refreshing the page yeilds a different session_id().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top