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 can't start

Hi all, I have developed a website on xamp ( windows) and works perfectly, but on my server VPS (Centos 5.6) with php 5.4.26 do not work. The session can't start. This is var_dump($session).

LOCAL:

object(Phalcon\Session\Adapter\Files)#97 (3) { ["_uniqueId":protected]=> NULL ["_started":protected]=> bool(true) ["_options":protected]=> NULL }

VPS SERVER:

object(Phalcon\Session\Adapter\Files)#11 (3) { ["_uniqueId":protected]=> NULL ["_started":protected]=> bool(false) ["_options":protected]=> NULL }

On this server I have many other applications developed in Symfony2, codeigniter, and sessions works perfectly.

Any idea? I've recompiled Phalcon 2 times and still not working.

Phalcon has an inconvenient habit of hiding any errors/warnings/notices it encounters. There's a chance one of those is being generated when Phalcon tries to start the session. The most common problem is that output has already been sent to the browser before session_start() is called internally.

You can either reconfigure PHP to log all errors to a file, then check that file, or you can call exit() before the view gets displayed. Either way, you should see the error being generated.



3.8k
edited May '14

I've solved the problem, basically had an "output" before making the session_start (), but Phalcon does not show the classic error (session_start() Cannot send session cache limiter headers alredy sent).

Thank you #quasipickle for giving me an idea with your comment.