为什么会议Kohana 3.3?

时间:2015-08-25 19:21:30

标签: php kohana kohana-3 kohana-auth

将PHP从版本4更新到5.5后,在Kohana 3.3.3停止工作会话..当您调用:Session :: instance('database')时出现错误:“读取会话数据时出错。”

为什么?

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() 

2 个答案:

答案 0 :(得分:1)

首先。 在php ini检查会话保存路径,以及保存会话文件的目录权限。就我而言,它是/ tmp。

转到/ VAR / LOG并检查apache错误日志。

然后,打开SYSPATH / application / bootstrap.php 查找

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

更改为

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

你会看到错误形成你的php解释器或apache。

如果它没有帮助你。

查找SYSPATH / classes / Kohana / Session.php [324] 并替换它

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

并将其替换为

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

你会发现你的错误。 在我的情况下,它是数据库错误。

答案 1 :(得分:0)

用PHP 5.5需要使用模块melancholy,或PDO,而不是mysql,好吧,或者只是将这些错误的输出关闭到index.php

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

相关问题