Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1016 - Can't open file: 'sessions.MYI'. (errno: 145)


ntxx

Recommended Posts

when opening my site I receive this error.

 

1016 - Can't open file: 'sessions.MYI'. (errno: 145)

select value from sessions where sesskey = '0aef4bbdcdd2b911f19fd86d820e507f' and expiry > '1060355962'

 

Site is down and looking for a fast solution.

Thanks

Link to comment
Share on other sites

drop and re-create the table.

 

Then go back and read some of the threads on the first page of this very forum.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

I got this problem today, running since around three months ago without any problem.

 

My host is using mysql v4.0.14 standard (for Linux), since is the last one available, I wonder if I'll get this problem again.

 

Anyone else with same setup and problem ?

 

Gradius

Link to comment
Share on other sites

Here's a fix inspired from burt code:

 

1. Create a clean copy of the whos_online AND sessions tables.

Use PHPMyAdmin for this:

 

CREATE TABLE whos_online_copy (

customer_id int(11) default NULL,

full_name varchar(64) NOT NULL default '',

session_id varchar(128) NOT NULL default '',

ip_address varchar(15) NOT NULL default '',

time_entry varchar(14) NOT NULL default '',

time_last_click varchar(14) NOT NULL default '',

last_page_url varchar(64) NOT NULL default ''

) TYPE=MyISAM;

 

CREATE TABLE sessions_copy (

sesskey varchar(32) NOT NULL default '',

expiry int(11) unsigned NOT NULL default '',

value text NOT NULL default '',

PRIMARY KEY (sesskey)

) TYPE=MyISAM;

 

 

2. Edit includes/functions/database.php:

 

Remove this:

-----------

 

function tep_db_error($query, $errno, $error) {

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

Replace with this:

-----------------

 

function tep_db_error($query, $errno, $error) {

mysql_query('DROP TABLE IF EXISTS whos_online');

mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0');

$res = mysql_query('SHOW CREATE TABLE whos_online_copy');

$row = mysql_fetch_assoc($res);

$create = preg_replace('/^CREATE TABLE whos_online_copy/', 'CREATE TABLE whos_online', $row['Create Table']);

mysql_query($create);

mysql_query('INSERT INTO whos_online SELECT * FROM whos_online_copy');

mysql_query('DROP TABLE IF EXISTS sessions');

mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0');

$res2 = mysql_query('SHOW CREATE TABLE sessions_copy');

$row2 = mysql_fetch_assoc($res2);

$create2 = preg_replace('/^CREATE TABLE sessions_copy/', 'CREATE TABLE sessions', $row2['Create Table']);

mysql_query($create2);

mysql_query('INSERT INTO sessions SELECT * FROM sessions_copy');

echo '<font color="red"><b>ERROR:</b></font><a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '"><u>Please click here to restart site</u></a><br><br>';

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

 

What does it do?

a) The whos_online AND sessions tables breaks.

B) The person browsing gets a [TEP STOP] error, BUT...

c) The whos_online and sessions are automatically recreated

d) SID is maintained

e) They are asked to hit a link to go back to default.php, OR...

f) They can just press refresh

 

The code was clean up to permit users create both tables, or not (by editing the code), if they want it.

 

Gradius

Link to comment
Share on other sites

  • 4 weeks later...

Nice solution Gradius, thanks!

 

I have had one site that has gone down three times in seven days with this problem. It seems it is only with the latest versions of cPanel and MySQL... hope it get sorted soon.

Link to comment
Share on other sites

The fix mentioned above should only be regared as a temporary fix.

 

To permanently fix the issue, ask you host to upgrade the MySQL client services to the same version as the server services. The old client services are not compatible with the new server services.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...