Zen Cart Logo
Forums / Installing on a Linux/Unix Server / Error message trying to connnect to database

Error message trying to connnect to database

Views: 2,858

Results 1 to 7 of 7
29 Dec 2013, 10:38 PM
#1
joannem avatar

joannem

Zen Follower

Join Date:
Jul 2009
Posts:
110
Plugin Contributions:
0

Error message trying to connnect to database

Hi,

Hostgator inadvertently deleted my friend's store :( She's reinstalled it, but the database was ok. The main store is working ok, but when we try to log into the admin area, we get the following message:

PHP Fatal error:  Call to undefined method queryFactory::Execute() in /home4/lngstore/public_html/shop/lngstore_admin/includes/init_includes/init_db_config_read.php on line 13

The code for that file is:

<?php
/**
 * @package admin
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: init_db_config_read.php 3001 2006-02-09 21:45:06Z wilt $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}
// Determine the DATABASE patch level
  $project_db_info = $db->Execute("select * from " . TABLE_PROJECT_VERSION . " WHERE project_version_key = 'Zen-Cart Database' ");
  define('PROJECT_DB_VERSION_MAJOR',$project_db_info->fields['project_version_major']);
  define('PROJECT_DB_VERSION_MINOR',$project_db_info->fields['project_version_minor']);
  define('PROJECT_DB_VERSION_PATCH1',$project_db_info->fields['project_version_patch1']);
  define('PROJECT_DB_VERSION_PATCH2',$project_db_info->fields['project_version_patch2']);
  define('PROJECT_DB_VERSION_PATCH1_SOURCE',$project_db_info->fields['project_version_patch1_source']);
  define('PROJECT_DB_VERSION_PATCH2_SOURCE',$project_db_info->fields['project_version_patch2_source']);

// set application wide parameters
  $configuration = $db->Execute('select configuration_key as cfgKey, configuration_value as cfgValue
                                 from ' . TABLE_CONFIGURATION);
  while (!$configuration->EOF) {
    define($configuration->fields['cfgKey'], $configuration->fields['cfgValue']);
    $configuration->MoveNext();
  }

// set product type layout paramaters
  $configuration = $db->Execute('select configuration_key as cfgKey, configuration_value as cfgValue
                          from ' . TABLE_PRODUCT_TYPE_LAYOUT);

  while (!$configuration->EOF) {
    define($configuration->fields['cfgKey'], $configuration->fields['cfgValue']);
    $configuration->movenext();
  }
?>

The red code is line 13.
We can't figure out what is wrong - can someone please help us quickly, as the store has already been down for a couple of days.

30 Dec 2013, 5:44 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Error message trying to connnect to database

when you look at the table it's telling you in that line of code 'product_version' in the database what do you see?

i see this:
Attachment 13616

30 Dec 2013, 6:32 AM
#3
joannem avatar

joannem

Zen Follower

Join Date:
Jul 2009
Posts:
110
Plugin Contributions:
0

Re: Error message trying to connnect to database

Looks just like yours except for the date

30 Dec 2013, 1:06 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,085
Plugin Contributions:
56

Re: Error message trying to connnect to database

Are there any debug-log files in the store's /cache directory? The error you're getting leads me to believe that the initialization of the $db object has somehow failed.

30 Dec 2013, 4:18 PM
#5
joannem avatar

joannem

Zen Follower

Join Date:
Jul 2009
Posts:
110
Plugin Contributions:
0

Re: Error message trying to connnect to database

There are two files in there - here they are - removing the password info etc.

installerConfigKeys|a:10:{s:8:"language";s:7:"english";s:16:"DIR_FS_SQL_CACHE";s:38:"/home4/lngstore/public_html/shop/cache";s:10:"is_upgrade";s:1:"1";s:7:"DB_TYPE";s:5:"mysql";s:10:"DB_CHARSET";s:4:"utf8";s:9:"DB_PREFIX";s:0:"";s:9:"DB_SERVER";s:9:"localhost";s:18:"DB_SERVER_USERNAME";s:14:"xxxxxxx";s:18:"DB_SERVER_PASSWORD";s:24:"xxxxxxxxxxxxxxxx";s:11:"DB_DATABASE";s:15:"lngstore_lng150";}logfilename|s:27:"Dec-28-2013_03-16-01-px0lM8";installerConfigInfo|a:0:{}
installerConfigKeys|a:1:{s:8:"language";s:7:"english";}

I don't know what all that means :S

Thanks,
Joanne

30 Dec 2013, 10:15 PM
#6
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Error message trying to connnect to database

First double check all of the settings in both "configure.php" files to ensure all the filesystem paths are correct. If nothing jumps out, try this (and let us know what happens):

  1. Grab a "clean" copy of Zen Cart 1.5.0
  2. Upload the "/admin" folder (use another name, different from your current admin folder name)
  3. Copy "/current_admin_folder/includes/configure.php" to "/test_admin_folder/includes/configure.php".
  4. If you upgraded from 1.3.9x, you may need to edit the "configure.php" to fix filesystem paths (to reflect the new path to "/test_admin_folder"). Keep in mind this file is usually readonly, so you may need to change permissions to edit the file.
30 Dec 2013, 11:31 PM
#7
joannem avatar

joannem

Zen Follower

Join Date:
Jul 2009
Posts:
110
Plugin Contributions:
0

Re: Error message trying to connnect to database

It's resolved now, she just totally reinstalled 1.5 :D