Skip to content

Commit

Permalink
CIL-895 Config option for PHP session file store directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrencegf committed Dec 10, 2020
1 parent c5dd1cd commit 562ec10
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Service/Util.php
Expand Up @@ -392,6 +392,18 @@ public static function startPHPSession($storetype = null)

if (preg_match('/^mysql/', $storetype)) {
$sessionmgr = new SessionMgr();
} elseif ($storetype == 'file') {
// If storing PHP sessions to file, check if an optional directory
// for storage has been set. If so, create it if necessary.
if ((defined('STORAGE_PHPSESSIONS_DIR')) && (!empty(STORAGE_PHPSESSIONS_DIR))) {
if (!is_dir(STORAGE_PHPSESSIONS_DIR)) {
mkdir(STORAGE_PHPSESSIONS_DIR, 0770, true);
}

if (is_dir(STORAGE_PHPSESSIONS_DIR)) {
ini_set('session.save_path', STORAGE_PHPSESSIONS_DIR);
}
}
}

ini_set('session.cookie_secure', true);
Expand Down

0 comments on commit 562ec10

Please sign in to comment.