Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: GLOBALS['db'] not getting set right...

  1. #1
    LeFou is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    12

    Default GLOBALS['db'] not getting set right...

    Sorry, to repost but first attempt didn't get any response. Let me know if I'm asking in the wrong way

    I'm beginning to suspect that my PHP/Apache installation are to blame for the problem pasted below. I use XAMPP on my dev machine, and it install the server, php, and pear in /opt/lampp instead of /var/www. Could that be it? Should I also try switching to php v 4?

    M
    -----------------------------------------------

    I'm doing some work on Sugar for a client, and have installed a version locally. It's very finicky and frequently bombs with this error:

    Fatal error: SugarBean::save() [function.save]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "DB_mysql" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /opt/lampp/htdocs/SugarSuite-Full-4.2.1b/data/SugarBean.php on line 779
    $GLOBALS['db'] is just not getting set right.

    ...or a similar error in jsAlerts, which I was able to suppress by commenting out
    $this->addActivities();

    This morning I restarted the instance that was failing in this way last night, and it looked like it had "fixed itself" until it ran a query, and it reported that the database server had gone unavailable during the query (forgot which). Other sites on the same machine work fine and interact with the database successfully, so I don't think the server itself really went unavailable.

    OS: Fedora Core 5
    SugarCRM version: 4.2.1b
    Webserver Apache 2
    PHP: 5.0.5 (also test on 4.4.1
    MySQL 5.0.15

  2. #2
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: GLOBALS['db'] not getting set right...

    Everything look hunky dory in the config.php file? Check to make suare there are no miss-spelled/incomplete URLs etc.

  3. #3
    LeFou is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    12

    Default Re: GLOBALS['db'] not getting set right...

    Thanks for helping

    Yeah, config.php looks fine to me even though I'm a newb. I don't think anything very fundamental can be broken, since I do in fact get a working installation. And I can click around and do a few things. For example I was able to add a calendar item. Then it burst when I tried to add a second one...

  4. #4
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: GLOBALS['db'] not getting set right...

    Anything in the logfile? Either with the default settings (fatal) from log4php.properties or when the other options are enabled?

  5. #5
    LeFou is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    12

    Default Re: GLOBALS['db'] not getting set right...

    ---------------------------
    log4php.properties
    ---------------------------
    log4php.appender.A2=LoggerAppenderRollingFile
    log4php.appender.A2.MaxFileSize=10MB
    log4php.appender.A2.MaxBackupIndex=5
    log4php.appender.A2.layout=LoggerLayoutTTCC
    log4php.appender.A2.layout.ContextPrinting="true"
    log4php.appender.A2.layout.DateFormat="%c"
    log4php.appender.A2.File=./sugarcrm.log

    log4php.rootLogger=fatal, A2
    //log4php.rootLogger=error, A2
    //log4php.rootLogger=warn, A2
    //log4php.rootLogger=info, A2
    //log4php.rootLogger=debug, A2

    Greek to me....

  6. #6
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: GLOBALS['db'] not getting set right...

    That's the config file. You have fatal errors being logged only. The log file being created is called sugarcrm.log and it's in the root of the sugarcrm directory.

    Have a look in that file for any clues. You can subsequently remove the commenting-out ('//') for the other logging options (error, warn, info, debug) to see if that gleans more details. Be ware that if you display info and debug, the log file gets huge and can impact performance. So don't forget to go back to just logging fatal errors later.

    It wont hurt to look in the web server logs too just to make sure though in this case it looks code based.

  7. #7
    LeFou is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    12

    Default Re: GLOBALS['db'] not getting set right...

    I've gone a different route and have some more clues:
    database object was incomplete b/c it lost contact with the server during query. Specifically:

    Query Failed:SELECT accounts.id as account_id, accounts.name as account_name, /* longreach - modified */ accounts.assigned_user_id account_name_owner, /* longreach - added */ opportunities.amount * opportunities.probability / 100 as weighted_amount, opportunities.amount_usdollar * opportunities.probability / 100 as weighted_amount_usdollar, users.user_name as assigned_user_name ,opportunities.* FROM opportunities LEFT JOIN users ON opportunities.assigned_user_id=users.id LEFT JOIN accounts_opportunities ON opportunities.id=accounts_opportunities.opportunit y_id LEFT JOIN accounts ON accounts_opportunities.account_id=accounts.id where (opportunities.sales_stage <> 'Closed Won' AND opportunities.sales_stage <> 'Closed Lost' AND opportunities.assigned_user_id='1') AND (accounts_opportunities.deleted is null OR accounts_opportunities.deleted=0) AND (accounts.deleted is null OR accounts.deleted=0) AND opportunities.deleted=0 ORDER BY probability DESC, amount DESC LIMIT 0,5::MySQL error 2013: Lost connection to MySQL server during query

    I pasted this query into phpMyAdmin to see what was up and it said:

    SQL query: Edit

    SHOW TABLE STATUS LIKE 'opportunities';

    MySQL said: Documentation
    #2006 - MySQL server has gone away

    Which is odd b/c that line isn't actually in the original query... MySQL is version 5.0.15

  8. #8
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: GLOBALS['db'] not getting set right...

    Odd - have a look in the mysql logs to see if there is anything in there. You might need to enable mysql logging in it's ini file (something like /etc/mysql/my.ini or my.cnf). It could be that some of the ini file settings are inapropriate, timeouts etc.

  9. #9
    LeFou is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    12

    Default Re: GLOBALS['db'] not getting set right...

    I was able to get a bit more reliability by extending maximum packet size in mysql... since this error has been off-and-on, it's hard to tell if it's actually fixed. I know one of my test Sugar installations did not benefit, and exits with the same error. I'll look ove the logs.

  10. #10
    kpit's Avatar
    kpit is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Dec 2005
    Location
    Memphis, TN
    Posts
    996

    Default Re: GLOBALS['db'] not getting set right...

    I had the same problem with the packet size but I do not thing that is the problem. I am beginning to suspect a corrupt table in mysql. Check the database for errors by shutting down MySQL and running database check if it fails then try to repair. otherwise go to a known good backup and restore it.
    Cheers,

    Max W. Blackmer, Jr.

    Blog
    Phone: +1 (901) 672-2694



Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •