This malfunction is due to a “hole” in the phpbb forum itself.

It consists in the fact that the forum stores all sessions in the database without deleting them, or deleting them with such frequency that, in the end, the session table becomes full and the forum displays the error “phpBB: Critical error. Error creating new session", because cannot continue to work with so many sessions.

To resolve the error, do the following:

  • open the forum root directory
  • open the file includes/sessions.php
  • find line 152
  • replace this line
  1. message_die(CRITICAL_ERROR,'Error creating new session'''__LINE____FILE__$sql);
    on next:
    $error TRUE;
    if (
    SQL_LAYER == "mysql" || SQL_LAYER == "mysql4")
    {
      
    $sql_error $db->sql_error($result);
      if (
    $sql_error["code"] == 1114)
      {
        
    $result $db->sql_query('SHOW TABLE STATUS    LIKE "'.SESSIONS_TABLE.'"');
        
    $row $db->sql_fetchrow($result);
        if (
    $row["Type"] == "HEAP")
        {
          if (
    $row["Rows"] > 2500)
          {
            
    $delete_order = (SQL_LAYER=="mysql4") ? "         ORDER BY session_time ASC" "";
            
    $db->sql_query("DELETE QUICK FROM ".        SESSIONS_TABLE."$delete_order LIMIT 50");
          }
          else
          {
            
    $db->sql_query("ALTER TABLE ".SESSIONS_TABLE." MAX_ROWS=".($row["Rows"]+50));
          }
          if (
    $db->sql_query($sql))
          {
            
    $error FALSE;
          }
        }
      }
    }
    if (
    $error)
    {
      
    message_die(CRITICAL_ERROR"Error creating new  session"""__LINE____FILE__$sql);
    }
  2. save the file and copy it to the server, overwriting the existing one.

Now you don't have to worry about the session table in the phpBB forum database being full.

Ця відповідь вам допомогла? 61 Користувачі вважають це корисним (183 Голосів)