Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Accessing admin - Lost connection problem


Guest

Recommended Posts

Posted

Warning: mysql_pconnect(): Lost connection to MySQL server during query in /home/keeg/www/admin/includes/functions/database.php on line 17

Unable to connect to database server!

 

And the rest of the page is blank.

 

This suddenly appeared when trying to access /admin

 

Everything elso on the page works, and I have made no changes at all. Does anyone know what I should do to make it work ?

Posted

OK, somewhat confusing message you posted -

And the rest of the page is blank.

 

Everything elso on the page works

 

So, which is it?

 

What were you doing when the rror happened, is it the entire page blank with just that message, or is it a section of the page displaying that message whilst everything else works? The answer to this question will make the solution SO much easier for those of us who cant see your screen to figure out what is happening!

Posted

line 17 of your database.php file reads:

$$link = mysql_pconnect($server, $username, $password);

amend this to:

// $$link = mysql_pconnect($server, $username, $password);

 

That should then allow you to enter your admin panel. Let me know if it works!

Posted

It didn't make any difference.....

 

 

<?php
/*
 $Id: database.php,v 1.21 2003/06/09 21:21:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
global $$link;

if (USE_PCONNECT == 'true') {
  // $$link = mysql_pconnect($server, $username, $password);
} else {
  $$link = mysql_connect($server, $username, $password);
}

if ($$link) mysql_select_db($database);

return $$link;
 }

 function tep_db_close($link = 'db_link') {
global $$link;

return mysql_close($$link);
 }

 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>');
 }

 function tep_db_query($query, $link = 'db_link') {
global $$link;

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
  error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
   $result_error = mysql_error();
   error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

return $result;
 }

 function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
reset($data);
if ($action == 'insert') {
  $query = 'insert into ' . $table . ' (';
  while (list($columns, ) = each($data)) {
	$query .= $columns . ', ';
  }
  $query = substr($query, 0, -2) . ') values (';
  reset($data);
  while (list(, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= 'now(), ';
		break;
	  case 'null':
		$query .= 'null, ';
		break;
	  default:
		$query .= '\'' . tep_db_input($value) . '\', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ')';
} elseif ($action == 'update') {
  $query = 'update ' . $table . ' set ';
  while (list($columns, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= $columns . ' = now(), ';
		break;
	  case 'null':
		$query .= $columns .= ' = null, ';
		break;
	  default:
		$query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ' where ' . $parameters;
}

return tep_db_query($query, $link);
 }

 function tep_db_fetch_array($db_query) {
return mysql_fetch_array($db_query, MYSQL_ASSOC);
 }

 function tep_db_num_rows($db_query) {
return mysql_num_rows($db_query);
 }

 function tep_db_data_seek($db_query, $row_number) {
return mysql_data_seek($db_query, $row_number);
 }

 function tep_db_insert_id() {
return mysql_insert_id();
 }

 function tep_db_free_result($db_query) {
return mysql_free_result($db_query);
 }

 function tep_db_fetch_fields($db_query) {
return mysql_fetch_field($db_query);
 }

 function tep_db_output($string) {
return htmlspecialchars($string);
 }

 function tep_db_input($string) {
return addslashes($string);
 }

 function tep_db_prepare_input($string) {
if (is_string($string)) {
  return trim(tep_sanitize_string(stripslashes($string)));
} elseif (is_array($string)) {
  reset($string);
  while (list($key, $value) = each($string)) {
	$string[$key] = tep_db_prepare_input($value);
  }
  return $string;
} else {
  return $string;
}
 }
?>

Posted

Now this is confusing because the error message reads:

 

mysql_pconnect():

 

But by commenting out that line you should have either got access, or the error message should now read

 

mysql_connect():

 

Ok, try this - change:

 

if (USE_PCONNECT == 'true') {

// $$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

to:

 

//if (USE_PCONNECT == 'true') {

// $$link = mysql_pconnect($server, $username, $password);

//} else {

$$link = mysql_connect($server, $username, $password);

//}

 

lemme know - at the very least the error message should change.

Posted

k, well aside from double checking your database settings in admin/includes/configure.php, I'm stumped. U did check that...?

Posted

Yes, I did check.

 

Like I said, this suddenly just happened. Weird. I also tried restarting the sql-server without any change.

Posted

I still have the same problem..... Does anyone know what to do ?

Posted

Hi,

 

At my request, I have asked my provided to move me to a server with MySql V4.x .. Now, I am getting the same issue. (Migration was last night) I will spend some time fixing this and hopefully let you know how it was done. Maybe it will help you also.

 

I needed the database upgarded to support SugarCRM. I am trying to integrate both OSC and SugarCRM to provide a single view of our customer's communication, Orders, requests, emails, tel cons etc.

 

More soon I hope,

 

Regards

 

Gwyn

Posted

Update on above:

 

It turns out that they had not completed the build. So they still had things to do (I susspect an upgrade of PHP).

 

Anyway, just to let you know I was having the same error and now it is fine. So your problem could be that something has changed on the server by your provider.

 

Not much help I know, but it may be useful ?

 

Regards,

 

Gwyn.

Archived

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

×
×
  • Create New...