Zend框架:Multidb初始化失败 [英] Zend Framework: Multidb fails to initialize
问题描述
这用来工作,但通过它只是不工作其他程序员一些修改之后。我有这个code在我的引导:
This used to work but after some modifications by the other programmers it just fails to work. I have this code on my Bootstrap:
protected function _initDatabase ()
{
$resource = $this->getPluginResource('multidb');
$resource->init();
Zend_Registry::set('gtap', $resource->getDb('gtap'));
Zend_Registry::set('phpbb', $resource->getDb('phpbb'));
}
在加载时,这个错误显示出来:
Upon loading, this error shows up:
致命错误:调用成员函数的init()非对象中
/var/www/gamebowl3/application/Bootstrap.php线105
Fatal error: Call to a member function init() on a non-object in /var/www/gamebowl3/application/Bootstrap.php on line 105
我的php.ini对TIS的include_path此项:
My php.ini has this entry on tis include_path:
.:/usr/share/php:/etc/apache2/libraries
和我可以看到,multidb.php位于:
and the i can see that multidb.php is located in:
/etc/apache2/librarties/Zend/Application/Resource
有人能告诉我是什么原因造成的错误?谢谢!
Can somebody tell me what causes the error? Thanks!
推荐答案
我刚刚发现这个问题是在的application.ini。增加了一个新引入的设置通常的设定的configs。在这里,它是:
I just found out that the problem is in application.ini. Added a newly-introduced setting to the usual set of configs. Here it is:
;Gtap Database
resources.multidb.gtap.adapter = "PDO_MYSQL"
resources.multidb.gtap.host = "localhost"
resources.multidb.gtap.username = "root"
resources.multidb.gtap.password = "letmein1"
resources.multidb.gtap.dbname = "gtap"
resources.multidb.gtap.isDefaultTableAdapter = true
resources.multidb.gtap.default = true
;Forum Database
resources.multidb.phpbb.adapter = "PDO_MYSQL"
resources.multidb.phpbb.host = "localhost"
resources.multidb.phpbb.username = "root"
resources.multidb.phpbb.password = "letmein1"
resources.multidb.phpbb.dbname = "phpbb"
resources.multidb.phpbb.isDefaultTableAdapter = false
此外,请确保您有最新的Zend Framework库,并将其添加到PHP的include路径。这应该可以解决一切。
Also, make sure you have the latest Zend Framework Library and add it to PHP's include path. That should fix everything up.
这篇关于Zend框架:Multidb初始化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!