1

I am running a website using Joomla! 2.5.9 for 7 months. Everything was going fine until this week. On monday and today(Friday) web site fails to run because of ****_session table has been broken down. I don't have a chance to take a look at logs about what is wrong.

Anyway, I repaired the table on Monday and everything was normal until today. Today it repeated the same error. Then I repaired again. I don't want the table to be broken and don't want to repair it again.

I want to know if there is a vulnerability about Joomla! or there is something else on server side.

zkanoca
  • 9,664
  • 9
  • 50
  • 94
  • are you running the latest version of the Joomla 2.5 series (2.5.14)? and have you installed any extensions or edited any of the core Joomla files recently? – Lodder Sep 20 '13 at 06:10
  • @Lodder Joomla version is 2.5.9. I have installed/edited/updated nothing for six months. – zkanoca Sep 20 '13 at 06:14
  • You're 5 versions behind. Try upgrading to the latest version. It could be that your site has been hacked. Have a read of this: http://stackoverflow.com/questions/11036763/joomla-2-5-4-hacked-having-trouble-with-diagnosis/11037642#11037642 – Lodder Sep 20 '13 at 06:15
  • How many records do you have in your sessions table? Have you considered truncating it or at least deleting all records? The only effect you have is that any logged in users will have to re-login (I had a table with thousands of rows – Riccardo Zorn Sep 20 '13 at 07:44

3 Answers3

3

For some reason, I get this error sometimes, so I have automated a fix with a cron job:

<?php

$sites = array('http://www.yoursite.com', 'http://www.yourothersite.com');
foreach($sites as $site) {
  $content = file_get_contents($site);
  if (strpos($content, 'error') !== false) {
    mail('myself@myself.com', 'Error found: '.$site,
         $site.' reported an error:<br/><br/>'.$content,
         'From: Myself <myself@myself.com>');
  }
  if (strpos($content, 'jtablesession::Store Failed') !== false) {
    // run repair table
    $con = mysql_connect('localhost', 'user', 'pass');
    mysql_select_db('yoursite_db_name', $con);
    // you might want to add an if here, if you have many sites to check
    mysql_query('REPAIR TABLE `yourprefix_session`', $con);
    mysql_close($con);
    mail('myself@myself.com', 'Repaired #__session', 'From: Myself <myself@myself.com>');
  }
}

?>

Keep in mind that I use this only for Joomla 1.5 sites. You may want to change the errors searched if they are different for 2.5 or 3.0.

mavrosxristoforos
  • 3,573
  • 2
  • 25
  • 40
3

I have made a page which repairs the table manually when crashed.

<?php
    //file = repair/index.php

    include '../configuration.php'; //has JConfig class

    $cfg = new JConfig();

    $mysqli = new mysqli($cfg->host, $cfg->user, $cfg->password, $cfg->db);

    if($mysqli->query('REPAIR TABLE prefix_session'))
        echo 'Hey!';
    else
        echo 'An error occured call zkanoca';
?>

when I call http://example.com/repair it is OK.

zkanoca
  • 9,664
  • 9
  • 50
  • 94
2

I also lost a site to a corrupt "session" table in MySQL. The solutions I found were all WAY too complicated for what is a very simple and predictable problem, as documented here:

https://www.akeebabackup.com/documentation/admin-tools/database-tools.html

Simply, the session table needs periodic cleaning. Once it crashes, it can no longer be accessed using PHPmyAdmin (since the table is crashed, it cannot be accessed). Since the table is corrupt, and since the site cannot be accessed, you cannot access the Admin Tools either.

So, through the cpanel, using PHPmyAdmin, in the database section, in the SQL tab for the site's DB, I typed:

REPAIR TABLE [prefix]_session

and then clicked Go

Problem solved. Site reappeared.

zkanoca
  • 9,664
  • 9
  • 50
  • 94