2015-10-13 51 views
0

我笨3.0網站,該網站已經啓動並運行,直到今天早上,已經停止了工作,突然,呈現在所有頁面上出現以下錯誤信息:如何調試笨致命錯誤

Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php:160)

Filename: core/Common.php

Line Number: 569
A PHP Error was encountered

Severity: Error

Message: Call to a member function row() on a non-object

Filename: drivers/Session_database_driver.php

Line Number: 160

而且,在error_log中顯示以下錯誤消息:兩天前兩個&的內存耗盡消息(不知道它們是否相關,因爲網站在這些之後運行良好,並且它們只出現兩次),然後很多的相同的PHP致命錯誤(我只複製了三個,但有很多很多相同的錯誤):

[10-Oct-2015 06:04:04 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes) in /home/[mysite]/public_html/system/database/DB_driver.php on line 919

[11-Oct-2015 02:52:43 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /home/[mysite]/public_html/system/database/drivers/mysqli/mysqli_result.php on line 168

[13-Oct-2015 08:25:51 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160

[13-Oct-2015 08:26:08 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160

[13-Oct-2015 08:26:17 UTC] PHP Fatal error: Call to a member function row() on a non-object in /home/[mysite]/public_html/system/libraries/Session/drivers/Session_database_driver.php on line 160

Session_database_driver.php 160行是這樣的:

 if (($result = $this->_db->get()->row()) === NULL) 

和線569在core/Common.php是這樣的:

 header($server_protocol.' '.$code.' '.$text, TRUE, $code); 

這是包含臭名昭著線160的功能:

public function read($session_id) 
    { 
     if ($this->_get_lock($session_id) !== FALSE) 
     { 
      // Needed by write() to detect session_regenerate_id() calls 
      $this->_session_id = $session_id; 

      $this->_db 
       ->select('data') 
       ->from($this->_config['save_path']) 
       ->where('id', $session_id); 

      if ($this->_config['match_ip']) 
      { 
       $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); 
      } 

      if (($result = $this->_db->get()->row()) === NULL) 
      { 
       $this->_fingerprint = md5(''); 
       return ''; 
      } 

      // PostgreSQL's variant of a BLOB datatype is Bytea, which is a PITA to work with, so we use base64-encoded data in a TEXT field instead. 
      $result = ($this->_platform === 'postgre') 
       ? base64_decode(rtrim($result->data)) 
       : $result->data; 

      $this->_fingerprint = md5($result); 
      $this->_row_exists = TRUE; 
      return $result; 
     } 

     $this->_fingerprint = md5(''); 

     return ''; 
    } 

但他們都是原始的CI文件。我沒有改變任何東西。

我不知道什麼地方出了問題,是什麼導致了這一點,我不知道如何開始調試它,因爲錯誤信息都指向CI文件,而不是我寫的代碼。

任何指針如何開始調試,將不勝感激!

+0

添加與此相關的 –

+0

完整的代碼這正是問題 - 我不知道有什麼相關的代碼做,因爲錯誤消息不指向我的代碼中的任何特定行,只在線路框架的原始文件。 – einav

+0

添加此代碼的地方'if(($ result = $ this - > _ db-> get() - > row())=== NULL)' –

回答

0

好的。弄清楚了!發佈解決方案以防其他人可能遇到同樣的問題。

This question已經讓我檢查我的ci_session表,並且當試圖訪問phpMyAdmin表時,彈出一個錯誤窗口,表示表被標記爲壓碎並應該被修復。

在cPanel上,我進入數據庫> MySQL數據庫,然後單擊「修復數據庫」。它立即修復了,瞧!我的網站恢復了生機。

修復操作結束時顯示以下幾行代碼,因此在那裏出現了一些錯誤。什麼和爲什麼 - 我仍然不知道。如果任何人有任何想法可能會導致會話表損壞,我很樂意聽到。

[mydb.ci_sessions3] info: Wrong bytesec: 49- 52- 52 at 797796; Skipped

[mydb.ci_sessions3] info: Wrong bytesec: 49- 52- 52 at 797796; Skipped

[mydb.ci_sessions3] info: Wrong bytesec: 49- 52- 52 at 797796; Skipped

[mydb.ci_sessions3] warning: Number of rows changed from 868 to 864

[mydb.ci_sessions3] status: OK