Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



62.9k

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!



62.9k

length is the hash length

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



1.4k
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.