Re: [SMARTY] Caching/Database Problem

From: Date: Wed, 26 Mar 2003 19:35:57 +0000
Subject: Re: [SMARTY] Caching/Database Problem
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8923@lists.php.net to get a copy of this message
Well, the pre-PEAR DB error messages were: [19-Mar-2003 09:21:56] PHP Warning: Supplied argument is not a valid PostgreSQL link resource in /usr/local/httpd/phplib/db/postgresql.php on line 39 [19-Mar-2003 09:21:56] PHP Warning: Supplied argument is not a valid PostgreSQL result resource in /usr/local/httpd/phplib/db/postgresql.php on line 61 Once I started using the PEAR DB, the error messages became: [25-Mar-2003 23:56:52] PHP Fatal error: Call to a member function on a non-object in /usr/local/httpd/phplib/new/products.class.php on line 14 The corresponding line of code is: $result = $www->dbh->query ($query); and the database connection is established with: $this->dbh = db::connect (db_config ('website')); (where $this refers to the $www object, and db_config is a customized function that returns the appropriate DSN depending on which database I want to connect to) So it appears to be a problem establishing a database connection. But the fact that it doesn't happen ALL THE TIME is what baffles me. In fact, I've never been able to recreate the problem, either with or without caching. And yes, I do the "if (! $smarty->is_cached ('template.tpl', $cache_name)) {" thing. Any ideas? -- tracy On 3/26/03 10:13 AM, "messju mohr" <messju@lammfellpuschen.de> wrote: > On Wed, Mar 26, 2003 at 08:56:44AM -0800, Tracy Rotton wrote: >> Hello all, >> >> I'm having a weird problem trying to cache my database-driven site. Every >> so often, when it comes time for the page to redraw itself, the database >> connection doesn't seem to take and Smarty ends up caching a blank page. >> When I go in and remove the offending page from the cache and then hit it >> again with my browser, it works fine. >> >> The weird thing is this seems to be an intermittent problem which I've never >> been able to recreate it (only seen it happen in the PHP error log). At >> first I thought it might have something to do with bots crawling the site, >> but now I'm not so sure. > > maybe we could help, if you share with us what is shown in your error-log, > when this happens. > >> I was using my own database wrappers, but I switched to using the PEAR DB >> methods and the problem is still cropping up. >> >> For the record, I'm running PHP 4.1.2 with apache 1.3.23 on Red Hat Linux >> and Smarty version 2.3.1. >> >> Thanks in advance, >> Tracy

« previous php.smarty.general (#8923) next »