@@ -358,8 +358,8 @@ same way:
358358 unusable during the same request after you destroy the session.
359359
360360You may also use the ``stop() `` method to completely kill the session
361- by removing the old session_id , destroying all data, and destroying
362- the cookie that contained the session id :
361+ by removing the old session ID , destroying all data, and destroying
362+ the cookie that contained the session ID :
363363
364364.. literalinclude :: sessions/038.php
365365
@@ -390,26 +390,35 @@ all of the options and their effects.
390390You'll find the following Session related preferences in your
391391**app/Config/App.php ** file:
392392
393- ============================== ============================================ ================================================= ============================================================================================
394- Preference Default Options Description
395- ============================== ============================================ ================================================= ============================================================================================
396- **sessionDriver ** CodeIgniter\\ Session\\ Handlers\\ FileHandler CodeIgniter\\ Session\\ Handlers\\ FileHandler The session storage driver to use.
397- CodeIgniter\\ Session\\ Handlers\\ DatabaseHandler
398- CodeIgniter\\ Session\\ Handlers\\ MemcachedHandler
399- CodeIgniter\\ Session\\ Handlers\\ RedisHandler
400- CodeIgniter\\ Session\\ Handlers\\ ArrayHandler
401- **sessionCookieName ** ci_session [A-Za-z\_ -] characters only The name used for the session cookie.
402- **sessionExpiration ** 7200 (2 hours) Time in seconds (integer) The number of seconds you would like the session to last.
403- If you would like a non-expiring session (until browser is closed) set the value to zero: 0
404- **sessionSavePath ** null None Specifies the storage location, depends on the driver being used.
405- **sessionMatchIP ** false true/false (boolean) Whether to validate the user's IP address when reading the session cookie.
406- Note that some ISPs dynamically changes the IP, so if you want a non-expiring session you
407- will likely set this to false.
408- **sessionTimeToUpdate ** 300 Time in seconds (integer) This option controls how often the session class will regenerate itself and create a new
409- session ID. Setting it to 0 will disable session ID regeneration.
410- **sessionRegenerateDestroy ** false true/false (boolean) Whether to destroy session data associated with the old session ID when auto-regenerating
411- the session ID. When set to false, the data will be later deleted by the garbage collector.
412- ============================== ============================================ ================================================= ============================================================================================
393+ ============================== ================== =========================== ============================================================
394+ Preference Default Options Description
395+ ============================== ================== =========================== ============================================================
396+ **sessionDriver ** FileHandler::class FileHandler::class The session storage driver to use.
397+ DatabaseHandler::class All the session drivers are located in the
398+ MemcachedHandler::class ``CodeIgniter\Session\Handlers\ `` namespace.
399+ RedisHandler::class
400+ ArrayHandler::class
401+ **sessionCookieName ** ci_session [A-Za-z\_ -] characters only The name used for the session cookie.
402+ The value will be included in the key of the
403+ Database/Memcached/Redis session records. So, set the value
404+ so that it does not exceed the maximum length of the key.
405+ **sessionExpiration ** 7200 (2 hours) Time in seconds (integer) The number of seconds you would like the session to last.
406+ If you would like a non-expiring session (until browser is
407+ closed) set the value to zero: 0
408+ **sessionSavePath ** null None Specifies the storage location, depends on the driver being
409+ used.
410+ **sessionMatchIP ** false true/false (boolean) Whether to validate the user's IP address when reading the
411+ session cookie. Note that some ISPs dynamically changes the IP,
412+ so if you want a non-expiring session you will likely set this
413+ to false.
414+ **sessionTimeToUpdate ** 300 Time in seconds (integer) This option controls how often the session class will
415+ regenerate itself and create a new session ID. Setting it to 0
416+ will disable session ID regeneration.
417+ **sessionRegenerateDestroy ** false true/false (boolean) Whether to destroy session data associated with the old
418+ session ID when auto-regenerating
419+ the session ID. When set to false, the data will be later
420+ deleted by the garbage collector.
421+ ============================== ================== =========================== ============================================================
413422
414423.. note :: As a last resort, the Session library will try to fetch PHP's
415424 session related INI settings, as well as legacy CI settings such as
@@ -498,9 +507,9 @@ permissions will probably break your application.
498507Instead, you should do something like this, depending on your environment
499508::
500509
501- mkdir /<path to your application directory>/Writable /sessions/
502- chmod 0700 /<path to your application directory>/Writable /sessions/
503- chown www-data /<path to your application directory>/Writable /sessions/
510+ > mkdir /<path to your application directory>/writable /sessions/
511+ > chmod 0700 /<path to your application directory>/writable /sessions/
512+ > chown www-data /<path to your application directory>/writable /sessions/
504513
505514Bonus Tip
506515---------
@@ -518,6 +527,8 @@ In addition, if performance is your only concern, you may want to look
518527into using `tmpfs <https://eddmann.com/posts/storing-php-sessions-file-caches-in-memory-using-tmpfs/ >`_,
519528(warning: external resource), which can make your sessions blazing fast.
520529
530+ .. _sessions-databasehandler-driver :
531+
521532DatabaseHandler Driver
522533======================
523534
@@ -561,6 +572,10 @@ For PostgreSQL::
561572
562573 CREATE INDEX "ci_sessions_timestamp" ON "ci_sessions" ("timestamp");
563574
575+ .. note :: The ``id`` value contains the session cookie name (``Config\App::$sessionCookieName``)
576+ and the session ID and a delimiter. It should be increased as needed, for example,
577+ when using long session IDs.
578+
564579You will also need to add a PRIMARY KEY **depending on your 'sessionMatchIP'
565580setting **. The examples below work both on MySQL and PostgreSQL::
566581
@@ -595,6 +610,8 @@ when it generates the code.
595610 done processing session data if you're having performance
596611 issues.
597612
613+ .. _sessions-redishandler-driver :
614+
598615RedisHandler Driver
599616===================
600617
@@ -631,6 +648,8 @@ sufficient:
631648
632649.. literalinclude :: sessions/041.php
633650
651+ .. _sessions-memcachedhandler-driver :
652+
634653MemcachedHandler Driver
635654=======================
636655
0 commit comments