We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

session failure

php version 7.1.4

phalcon version 3.1.2

controller file :

namespace Application\Controller;
use Phalcon\Mvc\Controller;

class TestController extends Controller{

    public function indexAction(){
        $this->session->set("user-name", "Michael");
        var_dump($this->session->get('user-name'));
    }

    public function aAction(){
        $a = $this->session->has("user-name")
        $b = $this->session->get("user-name");

        var_dump($a, $b);
    }
}

index.php(Entry file):

$di->set('session', function(){
    $session = new SessionFile();
    $session->start();
    return $session;
}, true);

access ‘/Test/index’:

string(7) "Michael"

access '/Test/a':

bool(false)
NULL

why?

My Phalcon expansion comes from remi



85.5k

php configuration problem i would guess ?

or if you are using multiple servers ? than the file wont exist in different requests ?

php configuration problem i would guess ?

or if you are using multiple servers ? than the file wont exist in different requests ?

hi,

I update php.ini file:

session.sid_length from 32 to 40;

Why still can not get session data?

what should I do?

Thinks!



85.5k

length is the hash length

session.gc_maxlifetime is the life time.. if you using windows, boot an ubuntu virtual and code there ...



3.5k
Accepted
answer

length is the hash length

session.gc_maxlifetime is the life time.. if you using windows, boot an ubuntu virtual and code there ...

I got it

The reason is that I use yum to install php. /var/lib/php permissions are apache.

But I did not use apache as a web server, I used nginx.

I modified php-fpm authority for nginx, but I did not modify /var/lib/php permissions, resulting in session data has been stored does not go, then I gave nginx authority after the normal.

Sorry, i was using google translation. Some languages may not be fluent.

Thank you.