Zen Cart Logo
Forums / Installing on a Linux/Unix Server / Fatal error: Call to a member function Execute() on a non-object

Fatal error: Call to a member function Execute() on a non-object

Locked

Views: 8,701

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
24 Jul 2007, 10:48 PM
#1
oldtango avatar

oldtango

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Fatal error: Call to a member function Execute() on a non-object

I have had this error for a while now, but haven't had the time to attempt to fix it. I decided to go ahead and set up a new ZenCart site, and work on some custom templates. However I can't log into the admin section at all. The admin login screen and the cart front page both display this error.Fatal error: Call to a member function Execute() on a non-object in /var/www/localhost/htdocs/catalog/includes/functions/sessions.php on line 61This is the line in question in the above mentioned file.```
line 61 ### $total = $db->Execute($qid);


Can this be a problem with php or mysql.  I am running php-5.2.2 and mysql-5.0.44.  It seems that this problem started with some system updates a little while back.

TIA................................:smile:
25 Jul 2007, 12:09 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Fatal error: Call to a member function Execute() on a non-object

It seems you're using an older version of Zen Cart on a newer version of PHP.

What Zen Cart version did you install?

26 Jul 2007, 12:59 PM
#3
oldtango avatar

oldtango

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Re: Fatal error: Call to a member function Execute() on a non-object

DrByte:

It seems you're using an older version of Zen Cart on a newer version of PHP.

What Zen Cart version did you install?The Version I have installed is 1.3.7 which appears to be the latest version. I don't remember if I installed the adim patch or not, it's been awhile. I will download a fresh copy of the latest patched version and do a clean install.

27 Jul 2007, 6:07 AM
#4
dockarl avatar

dockarl

New Zenner

Join Date:
Aug 2006
Posts:
14
Plugin Contributions:
0

Re: Fatal error: Call to a member function Execute() on a non-object

Dr Byte I'm getting the very same error since moving across to a new server.

Upgrading to the newer version is something I'd like to avoid right at the moment as my 'customisations' weren't written as portably as I would have liked.

Any advice?

from the version.php file..

Major Version 1..

Minor version.. 3.0.2

27 Jul 2007, 8:54 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Fatal error: Call to a member function Execute() on a non-object

dockarl:

I'm getting the very same error since moving across to a new server.Is your new server running a different PHP version ?

You're probably experiencing the PHP5.2 incompatibility problems others have had when using ZC versions prior to v1.3.6 (where a workaround was added to handle a PHP 5.2 quirk). The fix is documented elsewhere on the forums: http://www.zen-cart.com/forum/showthread.php?t=50534#post287587

Or there are other thoughts discussed here:
http://www.zen-cart.com/forum/showthread.php?t=67476

27 Jul 2007, 11:53 AM
#6
dockarl avatar

dockarl

New Zenner

Join Date:
Aug 2006
Posts:
14
Plugin Contributions:
0

Re: Fatal error: Call to a member function Execute() on a non-object

Thanks DrByte - that fix worked perfectly.

For others that have stumbled across this thread via a search as I did, DrBytes Solution is below -

b. edit /includes/functions/sessions.php and /admin/includes/functions/sessions.php

Code:
function _sess_write($key, $val) {
global $db;
global $SESS_LIFE;

change to:

Code:
function _sess_write($key, $val) {
// The following is only to work around a PHP 5.2.0 bug:
global $db;
if (!is_object($db)) {
//PHP 5.2.0 bug workaround ...
$db = new queryFactory();
$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
}

  global $SESS_LIFE;Option (b) may or may not be "complete", and has only had preliminary testing. The best fix will be to have PHP fix their bug, of course.

28 Jul 2007, 2:43 PM
#7
oldtango avatar

oldtango

New Zenner

Join Date:
May 2006
Posts:
3
Plugin Contributions:
0

Re: Fatal error: Call to a member function Execute() on a non-object

After doing a clean install (version 1.3.7.1), the error is gone, and ZenCart is working properly once again. I must have had an upgrade issue from an older version to the newer. and not caught it...................................:blush:

Thanks for the help..............................:smile: