Can you help me locate PHP session files?

I find this command the easiest:

php -i | grep session.save_path


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


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

  1. Boot up a cmd prompt
    • Run php --ini and find the loaded configuration file
    • 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

Tags:

Php

Session