Jump to content

Getting $_SESSION Variables to Work


Recommended Posts

What settings do I need to change below to get my $_SESSION variables to work?  I have tried many thing and restarted my Apache server as many.  Please help.

 

thanks

 

Alan

================================

 

session.save_path = ""

 

session.name = "PHPSESSID"

 

session.save_handler = "files"

 

session.auto_start = "0"

 

session.gc_probability = "1"

 

session.gc_divisor = "100"

 

session.gc_maxlifetime = "1440"

 

session.serialize_handler = "php"

 

session.cookie_lifetime = "0"

 

session.cookie_path = "/"

 

session.cookie_domain = ""

 

session.cookie_secure = "0"

 

session.cookie_httponly = "0"

 

session.use_cookies = "1"

 

session.use_only_cookies = "1"

 

session.referer_check = ""

 

session.entropy_file = ""

 

session.entropy_length = "0"

 

session.cache_limiter = "nocache"

 

session.cache_expire = "0"

 

session.use_trans_sid = "0"

 

session.bug_compat_42 = "1"

 

session.bug_compat_warn = "1"

 

session.hash_function = "0"

 

session.hash_bits_per_character = "4"

 

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

 

Link to comment
https://forums.phpfreaks.com/topic/39404-getting-_session-variables-to-work/
Share on other sites

The default setting are fine. You cannot turn session on or off. They are part of PHP's core.

 

When using sessions make sure your have session_start(); on the first line of each page that uses sessions and that your web browser accepts cookies. If you dont have session_start(); as the first line of each page that uses sessions your session variables will not transfer from page to page.

 

Alss make sure you are not outputting anything before you call session_start either. This should work:

<?php
session_start();

$_SESSION['mySessVar'] = 'someValue'];

?>
Session variable set! <a href="file2.php">Next page</a>

<?php
session_start();

echo $_SESSION['mySessVar']; // -- output: 'someValue'

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.