tags:

views:

264

answers:

5

I have a default configuration of xampp (LAMP) on a windows system, I have been googleing and reading stackflow for an hour but I can not find where php session data is saved, I would like to locate a session file and look at it.

Some sites say windows usually stores it here C:\windows\tmp\ but I was unable to find it there or anywhere else.

  1. Do you know where sessions are saved by default?f
  2. Do you know what kind name and file? extension they might would have?
+3  A: 

To find the "for sure" location, do the following:

  1. Boot up a cmd prompt
  2. Run php --ini and find the loaded configuration file
  3. Open the config file and search for 'session.save_path'

That's the path your session files should be saved to.

This assumes that session.save_handler is set to 'files', of course, and isn't overridden anywhere in your code.

By default, it's probably "C:\WINDOWS\Temp". The filenames are generally prefixed with sess_, and do not have an extension.

Edit: Other posters are correct in using session_save_path() to find the path as well. That's probably a more foolproof method, in case there's differences between your CLI configuration and your web configuration. I'll hand out some +1's. :D

zombat
Your generous handing out of +1s has earnt you one yourself from me!
alex
+4  A: 

session_save_path() - they have no extension, they are long string UID named files.

Byron Whitlock
Thanks that worked great I am on the dev server so there is only 2 session files which is what i expected, the 1st one is only 1kb and has all my session variables I set on my site so it's good to see that it is small in size however the second file is 2 hours old and is nearly 1mb in size it has html tables and mysql queries and all kinds of stuff, do you know why that is in there?
jasondavis
+1  A: 

CTRL + F (windows Find)... search your XAMPP dir for files modified today (by date)...

scunliffe
+2  A: 

You can find where the sessions are stored for the current configuration by calling session_save_path() - this corresponds to the configuration setting session.save_handler as zombat says. The files I think are named by prefixing the session id with 'sess_'

Tom Haigh
+1  A: 

Make a php test page. If you haven't done this before simply save the following as a .php file

<?php phpinfo(); ?>

Look for session_save_path under the session section.

If it is set, this should tell you your session path.

Wil