当我运行索引文件后发生错误
我的索引文件是在
var/www/giftercity/dev/public/index.php
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "multidb" not found' in /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php:692 Stack trace: #0 /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php(627): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('multidb') #1 /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php(584): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap('multidb') #2 /var/www/Giftercity_backup/dev/application/Bootstrap.php(336): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap('multidb') #3 /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php(667): Bootstrap->_initUser() #4 /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php(620): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('user') #5 /var/www/Giftercity_backup/dev/library/Zend/A in /var/www/Giftercity_backup/dev/library/Zend/Application/Bootstrap/BootstrapAbstract.php on line 692
答案 0 :(得分:1)
据我所知,您试图引导multidb资源。
我个人刚刚在我的application.ini
中完成了这项工作 resources.multidb.defaultMetadataCache = "database"
resources.multidb.db1.adapter = "pdo_mysql"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.username = "webuser"
resources.multidb.db1.password = "XXXX"
resources.multidb.db1.dbname = "db1"
resources.multidb.db1.default = true
resources.multidb.db2.adapter = "pdo_pgsql"
resources.multidb.db2.host = "example.com"
resources.multidb.db2.username = "dba"
resources.multidb.db2.password = "notthatpublic"
resources.multidb.db2.dbname = "db2"
然后在我的bootstrap中创建了一个函数
protected function _initDb()
{
$resource = $this->getPluginResource('multidb');
Zend_Registry::set("multidb", $resource);
}
据我所知,在引导multidb时没有更多步骤。