• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Display a session file

In the development of my application, I have created a cool on/off function display for the administrative users of the site to be able to view detailed debug information in an effort to assist in the issue resolution. Having said this, I am wnating a simple way to show all current Session Variables which are set in the current session. These session variables are set when the user logs in and remain in effect till the user logs off.

My attempts have included the following;

 $f = file_get_contents( "/tmp/".session_id() );
 echo $f;

FAILS :
Warning: file_get_contents(/tmp/9a0553cdfcc15ff7f1e4bdf7722b282b) [function.file-get-contents]: failed to create stream: No such file or directory in /HIDDEN_VIEW/public_html/HIDDEN_VIEW/index.php on line 17


and

 <? INCLUDE("/tmp/".session_id());

FAILS :
Warning: main(/tmp/9a0553cdfcc15ff7f1e4bdf7722b282b) [function.main]: failed to create stream: No such file or directory in /HIDDEN_VIEW/public_html/HIDDEN_VIEW/index.php on line 23

Warning: main() [function.main]: Failed opening '/tmp/9a0553cdfcc15ff7f1e4bdf7722b282b' for inclusion (include_path='.:') in /HIDDEN_VIEW/public_html/HIDDEN_VIEW/index.php on line 23


Help... what will correct this. I am the physical server owner in my facility. I mention this in case there is a config parameter that is needing to change.

Thanks in advance for your help...
-greg
0
Gregory Miller
Asked:
Gregory Miller
  • 2
  • 2
1 Solution
 
Gregory MillerGeneral ManagerAuthor Commented:
additional info from phpinfo();
session
Session Support  enabled  
Registered save handlers  files user  

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_dividend 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 /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

0
 
VGRCommented:
either :
foreach ($_SESSION as $key=>$value) {
  echo "variable '$key' is set to $value'<BR>";
}

or

for ($i=0;$i<count($_SESSION);$i++) echo "variable '".$_SESSION[$i][0]."' is set to ".$_SESSION[$i][1]."'<BR>";
0
 
Gregory MillerGeneral ManagerAuthor Commented:
Worked like a champ...

Thanks,
-greg
0
 
VGRCommented:
de rien 8-)
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now