13

The session files are saved at session_save_path().'/sess_'.session_id().

Is 'sess_' hard-coded?

If it can be specified, how do I do that?

Flavius
  • 13,566
  • 13
  • 80
  • 126
  • 1
    If you've found an answer, submit an answer and accept it. Don't edit your question to include the answer, that's not how SO is meant to work. – user229044 Oct 24 '10 at 16:56

3 Answers3

21

Yes, sess_ is a hard-coded prefix for the session file name. You can see that in the source file mod_files.c:

#define FILE_PREFIX "sess_"
sierrasdetandil
  • 421
  • 1
  • 9
  • 16
Gumbo
  • 643,351
  • 109
  • 780
  • 844
  • Thanks. This let's me define a proper cleanup for my custom session directory ;) http://stackoverflow.com/questions/654310/cleanup-php-session-files – SimonSimCity Jun 12 '13 at 07:44
1

I think it's hard-coded - at least, I can see no configuration option or parameter to control this.

The manual page for session_save_handler() provides a full example for a custom handler. If all else fails, you can use that to implement your own handler, and change the naming format there.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
0

Answer found on http://php.net/manual/en/function.session-set-save-handler.php. It's hard-coded.

Flavius
  • 13,566
  • 13
  • 80
  • 126