Zend Framework: Multidb fails to initialize

陌路散爱 提交于 2020-01-01 19:03:15

问题


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:

Fatal error: Call to a member function init() on a non-object in /var/www/gamebowl3/application/Bootstrap.php on line 105

My php.ini has this entry on tis include_path:

   .:/usr/share/php:/etc/apache2/libraries

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!


回答1:


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

Also, make sure you have the latest Zend Framework Library and add it to PHP's include path. That should fix everything up.



来源:https://stackoverflow.com/questions/7924440/zend-framework-multidb-fails-to-initialize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!