session.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<walkor@workerman.net>
  10. * @copyright walkor<walkor@workerman.net>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. return [
  15. 'type' => 'file', // or redis or redis_cluster
  16. 'handler' => Webman\FileSessionHandler::class,
  17. 'config' => [
  18. 'file' => [
  19. 'save_path' => runtime_path() . '/sessions',
  20. ],
  21. 'redis' => [
  22. 'host' => '127.0.0.1',
  23. 'port' => 6379,
  24. 'auth' => '',
  25. 'timeout' => 2,
  26. 'database' => '',
  27. 'prefix' => 'redis_session_',
  28. ],
  29. 'redis_cluster' => [
  30. 'host' => ['127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7001'],
  31. 'timeout' => 2,
  32. 'auth' => '',
  33. 'prefix' => 'redis_session_',
  34. ]
  35. ],
  36. 'session_name' => 'PHPSID',
  37. 'auto_update_timestamp' => false,
  38. 'lifetime' => 7*24*60*60,
  39. 'cookie_lifetime' => 365*24*60*60,
  40. 'cookie_path' => '/',
  41. 'domain' => '',
  42. 'http_only' => true,
  43. 'secure' => false,
  44. 'same_site' => '',
  45. 'gc_probability' => [1, 1000],
  46. ];