Why do not the session Kohana 3.3?

952 Views Asked by At

After updating php from version 4 to 5.5, in Kohana 3.3.3 stopped working session .. When you call: Session :: instance ('database') there is an error: "Error reading session data."

Why is that?

Session_Exception [ 1 ]: Error reading session data.

SYSPATH/classes/Kohana/Session.php [ 324 ]

319             }
320         }
321         catch (Exception $e)
322         {
323             // Error reading the session, usually a corrupt session.
324             throw new Session_Exception('Error reading session data.', NULL, Session_Exception::SESSION_CORRUPT);
325         }
326 
327         if (is_array($data))
328         {
329             // Load the data locally

    SYSPATH/classes/Kohana/Session.php [ 125 ] » Kohana_Session->read(arguments)

    MODPATH/database/classes/Kohana/Session/Database.php [ 74 ] » Kohana_Session->__construct(arguments)

    SYSPATH/classes/Kohana/Session.php [ 54 ] » Kohana_Session_Database->__construct(arguments)

    APPPATH/classes/Controller/Base.php [ 17 ] » Kohana_Session::instance(arguments)

    APPPATH/classes/Controller/Index.php [ 9 ] » Controller_Base->before()

    SYSPATH/classes/Kohana/Controller.php [ 69 ] » Controller_Index->before()

    {PHP internal call} » Kohana_Controller->execute()

    SYSPATH/classes/Kohana/Request/Client/Internal.php [ 97 ] » ReflectionMethod->invoke(arguments)

    SYSPATH/classes/Kohana/Request/Client.php [ 114 ] » Kohana_Request_Client_Internal->execute_request(arguments)

    SYSPATH/classes/Kohana/Request.php [ 997 ] » Kohana_Request_Client->execute(arguments)

    DOCROOT/index.php [ 118 ] » Kohana_Request->execute() 
3

There are 3 best solutions below

0
entermix On BEST ANSWER

with php 5.5 need to use the module melancholy, or PDO, instead of mysql, well, or just turn off the output of these errors to index.php

http://webnotes.by/docs/php/kohana-3-2-and-php-5-5

0
Yam Frich On

Add a var_dump($e) inside the catch block in the kohana's Session.php file where the exception is being thrwoed (like in the code you pasted) and you will find the real problem ;)

0
Max Sherbakov On

First of all. check session save path at php ini, and catalog permission for save session files. In my case it was /tmp.

Goto /VAR/LOG and check apache errors log.

And then, open SYSPATH/application/bootstrap.php Find

Kohana::init(array(
    'base_url'   => '/',
    'index_file' => FALSE,
    'errors' => TRUE
));

Change to

Kohana::init(array(     'base_url'   => '/',    'index_file' => FALSE,
'errors' => FALSE ));

And You will see the errors form your's php interpreter or apache.

If it didn't helps You.

Find SYSPATH/classes/Kohana/Session.php [ 324 ] and replace it

throw new Session_Exception('Error reading session data.', NULL, Session_Exception::SESSION_CORRUPT);

and replace it to

throw new Session_Exception('Error reading session data.'. " [SID:".$id."(".$this->id()."), name:".$this->_name."][Details: " . $e . "]\n", NULL, Session_Exception::SESSION_CORRUPT);

And you will find out your's error. In My case it was database err.