$di->setShared('session', function () { $session = new SessionAdapter(); if(!isset($_SESSION)){ $session->start(); } return $session; });
hmmm, can you try
if (session_id()== ''){ $session->start(); }
did not work!
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(); ?>
phalcon version 2.0.7
OS: LINUX RED HAT
STORE SESSION : FILES
SESSION DIRECTORY: '/ '
Is the server load balanced ? no;
SESSION NATIVE is working .
there are some sesssion changes in 2.0.8 according to https://blog.phalcon.io/
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; });
I put session_start() at the beginning of public/index.php file, and the only way that worked
Thank you for your help.