We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Session name

By default PHP session cookie name is PHPSESSID, but by changing it to by example "my_sess_id" doesn`t change it. How to do it? Code:

$di->set('session', function() {
    $session = new SessionAdapter();
        session_name('my_sess_id');
    $session->start();
    return $session;
});

Request header:

Cookie:PHPSESSID=tje3ovbgfb2393v5hbnmpg6gt7;


98.9k
Accepted
answer

Maybe the session name has not been changed because it only can contain alphanumeric characters:

session_name('mysessid');

Edit: Tested with my_sess_id and it also work, but previously sent cookies are kept by the browser.



9.3k

Yea, problem was because of _, idk why it didn`t work on my machine... Thanks for support!