Session not working in my production server

$di->setShared('session', function () {
    $session = new SessionAdapter();
    if(!isset($_SESSION)){
        $session->start();
    }
    return $session;
});


62.9k
edited Oct '15

hmmm, can you try

if (session_id()== ''){
    $session->start();
}


62.9k

ok, so my guess would be server configuration problem.

what os, which version, where do you store sessions - files, redis, db ?

Is the server load balanced ?

Does the session directory exist ? if you go to it, does the php put files in there ? ( test it with simple test.php <?php session_start(); ?>

edited Oct '15

phalcon version 2.0.7

OS: LINUX RED HAT

STORE SESSION : FILES

SESSION DIRECTORY: '/ '

Is the server load balanced ? no;

SESSION NATIVE is working .



62.9k
edited Oct '15

there are some sesssion changes in 2.0.8 according to https://blog.phalconphp.com/

is it possible to upgrade and test it out ?

also is it possible to have a missplaced session_destroy somehere ?. Can you explain more how to you test it ? ( ex. I start the app , i login then i click on this button which does ajax, and boom session is empty inside ... )

//edit

also try with this just in case :

$di->setShared('session', function() {
    $session = new \Phalcon\Session\Adapter\Files();
    $session->start();
    return $session;
});
edited Oct '15

I put session_start() at the beginning of public/index.php file, and the only way that worked

Thank you for your help.