2008年11月26日星期三

Re: [fw-db] Couldn't fetch mysqli

On Wed, Nov 26, 2008 at 3:01 PM, <aurelijus@astdev.lt> wrote:
> Hi,
> I have this strange problem. If I try to use session save handler db
> table - I get these errors:
> <...>
> Warning: mysqli::real_escape_string()
> [function.mysqli-real-escape-string]: Couldn't fetch mysqli in
> /var/www/blake.lt/library/library-1.7.0/Zend/Db/Adapter/Mysqli.php on
> line 115
>
> Warning: mysqli::prepare() [function.mysqli-prepare]: Couldn't fetch
> mysqli in /var/www/blake.lt/library/library-1.7.0/Zend/Db/Statement/Mysqli.php
> on line 77
>
> Warning: Zend_Db_Statement_Mysqli::_prepare()
> [function.Zend-Db-Statement-Mysqli--prepare]: Couldn't fetch mysqli in
> /var/www/blake.lt/library/library-1.7.0/Zend/Db/Statement/Mysqli.php
> on line 79
>
> Warning: mysqli::real_escape_string()
> [function.mysqli-real-escape-string]: Couldn't fetch mysqli in
> /var/www/blake.lt/library/library-1.7.0/Zend/Db/Adapter/Mysqli.php on
> line 115
> <...>
>
> So, I have initDb function, which initializes database:
> $this->db = Zend_Db::factory(self::$_config->database->adapter,
> self::$_config->database->toArray());
> $this->db->query('SET NAMES utf8');
> Zend_Db_Table::setDefaultAdapter($this->db);
> And initSession:
> Zend_Session::setOptions(self::$_config->session->namespace->toArray());
> Zend_Session::setSaveHandler(new
> Zend_Session_SaveHandler_DbTable(self::$_config->session->handler->toArray()));
> $this->session = new Zend_Session_Namespace();
>
> If I don't use dbtable savehander, then everything works fine - no
> errors from the database.
> And if I use dbtable savehandler - I get errors above.
>
> Any suggestions?
>

I remember there was a bug in 5.1.x - what PHP version are you on? It
looks like the PHP connection handle is not available when the code is
trying to use it.

It might be also a general problem - e.g. did you doublecheck that all
your connection settings are correct and that all the config objects
are setup as expected?

Cheers,
Till

没有评论: