Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is the PHP function session_module_name for?

Tags:

php

session

PHP Session related functions have this one: session_module_name. The documentation only says:

session_module_name — Get and/or set the current session module

Nothing about what session modules are, what options available, and when it to use.

What is the purpose of this function?

like image 612
dmitry Avatar asked Dec 07 '11 13:12

dmitry


1 Answers

The session_module_name defines how sessions are stored. You can use this in conjunction with session_set_save_handler to handle sessions manually, such as if you wanted to save/load sessions from a database. A quick search shows that there are at least 3 modules

<?php
  session_module_name("files");  // ASCII files
  session_module_name("mm");     // Shared memory
  session_module_name("user");   // Custom session backend
?>

Perhaps there are more. It would be nice if the session_module_name docs entry was a bit more helpful.

like image 115
Matt Esch Avatar answered Oct 15 '22 11:10

Matt Esch