Session_destroy failed


#1

Hi all, I am completely new to CakePhp and trying to learn.
I have followed the tutorials and started trying to customize the code to see what I can do and what I can learn.

At some point in time, during my experiments with one sample project, it started showing 6 warning lines on the top of each page (I have debugging enabled and I am using CakePHP’s internal server).

Now I always get those lines, even if I start a new project from scratch. I really cannot understand where they come from and why. Sometimes they disappear for a while, but then they come back apparently for no reason.

Here are the lines:

Warning (2): session_destroy(): Session object destruction failed [CORE/src/Network/Session.php, line 509]

Warning (2): session_destroy() [<a href='http://php.net/function.session-destroy'>function.session-destroy</a>]: Session object destruction failed [CORE/src/Network/Session.php, line 509]

Warning (512): Unable to emit headers. Headers sent in file=/home/cristiano/public_html/bookmarker/vendor/cakephp/cakephp/src/Error/Debugger.php line=822 [CORE/src/Http/ResponseEmitter.php, line 48]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/cristiano/public_html/bookmarker/vendor/cakephp/cakephp/src/Error/Debugger.php:822) [CORE/src/Http/ResponseEmitter.php, line 149]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/cristiano/public_html/bookmarker/vendor/cakephp/cakephp/src/Error/Debugger.php:822) [CORE/src/Http/ResponseEmitter.php, line 181]

Warning (2): Cannot modify header information - headers already sent by (output started at /home/cristiano/public_html/bookmarker/vendor/cakephp/cakephp/src/Error/Debugger.php:822) [CORE/src/Http/ResponseEmitter.php, line 181]

If you need more info don’t hesitate to ask.
Thank you in advance.

Cris


#2

Did you issue a

$session->destroy();

Which version of cakephp? Are folder permissions properly setup? Are all required extensions that cakephp needs enabled? Check the little obvious stuff first.


#3

No, I did not issue a $session->destroy(). Not explicitly, at least. From what I can see in the warning lines, it is in CakePHP code itself.
Version of CakePHP is 3.4.5.

As I told, I am a complete beginner with CakePHP.
To know if folder permissions are properly setup I’d need to know which folder and what kind of permissions it needs. However, since the project is set up by composer and all the checkmarks on the initial page are green, I suppose everything is correctly set up. Same goes about your request to check that all required extensions are enabled.
The “little obvious stuff” is either not that obvious to me, as a beginner, or has already been checked.

However, in the mean time I was able to avoid the warning by changing the session configuration in app.php from

     'defaults' => 'php'

to

     'defaults' => 'cake'

I do not know if it is a permanent fix or only a temporary fix.

Thank you
Cris