note 129683 added to function.session-set-save-handler
| From: | polygon.co.in@gmail.com | Date: | Thu, 01 Aug 2024 08:08:23 +0000 |
| Subject: | note 129683 added to function.session-set-save-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221455@lists.php.net to get a copy of this message | ||
Sessions data can be saved in different modes eg; Files, SQL and No SQL databases.
But while benchmarking session it is observed File based session leads to depletion of inodes, SQL
databases leads to slower performance due to large number of indexed session ids and no SQL
databases leads to performance issues.
Benchmarking session is simulating session behaviour on attacks that may bring down a website or
effect website performance.
As a solution to this on can start the session as below in the common file.
if ( isset( $_COOKIE['PHPSESSID'] ) ) {
// Wrong cookie values won't create a new session file/entry.
// Because its a read only.
session_start(
[
'read_and_close' => true,
]
);
}
This will start a read only session.
Once you are done with this and later in script you need to make changes (add/remove) session data.
One can start the session in the normal way which we used to do earlier.
session_start();
and do required modifications.
$_SESSION[ââkey] = $value;
OR
unset($_SESSION[ââsome_key]);
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 45.118.105.147)
----
Manual Page -- https://php.net/manual/en/function.session-set-save-handler.php
Edit -- https://main.php.net/note/edit/129683
Del: integrated -- https://main.php.net/note/delete/129683/integrated
Del: useless -- https://main.php.net/note/delete/129683/useless
Del: bad code -- https://main.php.net/note/delete/129683/bad+code
Del: spam -- https://main.php.net/note/delete/129683/spam
Del: non-english -- https://main.php.net/note/delete/129683/non-english
Del: in docs -- https://main.php.net/note/delete/129683/in+docs
Del: other reasons-- https://main.php.net/note/delete/129683
Reject -- https://main.php.net/note/reject/129683
Search -- https://main.php.net/manage/user-notes.php