Welcome Guest, Not a member yet? Register   Sign In
Session files
#4

(06-28-2018, 12:38 PM)kilishan Wrote: It's handled by PHP's own garbage collection routine, which by default on many systems run every 100th request. It's possible there's a bug in the system, but largely dependent on what OS you're running and your server settings. Here's a decent explanation of what's going on and ways to work with it, even though it uses Symfony and Laravel for examples.

When GC happens, this should be ran.

I hate to dig up such an old thread but I have a follow up question that just fits exactly to the topic.

If I don't want to rely on PHP's own garbage collection and instead run the gc() method directly via cronjob for example, how do I do this?


I tried :

/app/Config/Routes.php
Code:
$routes->get('/gc', function () {
    $gc = new \CodeIgniter\Session\Handlers\FileHandler;
    if ($gc->gc(1800)) {
        echo "success";
    }
});

but with no success.

"ArgumentCountError
Too few arguments to function CodeIgniter\Session\Handlers\FileHandler::__construct(), 0 passed in /var/www/app/Config/Routes.php on line 94 and exactly 2 expected"

Am I on the right track or completly false with this approach?

thanks in advance
Reply


Messages In This Thread
Session files - by donpwinston - 06-28-2018, 11:01 AM
RE: Session files - by kilishan - 06-28-2018, 12:38 PM
RE: Session files - by ballpumpe - 04-27-2021, 09:41 PM
RE: Session files - by dave friend - 06-28-2018, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB