Zend Framework:Multidb 无法初始化

发布于 2024-12-12 15:56:23 字数 713 浏览 0 评论 0原文

这曾经有效,但经过其他程序员的一些修改后,它就无法工作了。我的 Bootstrap 上有此代码:

    protected function _initDatabase ()
{
    $resource = $this->getPluginResource('multidb');
    $resource->init();

    Zend_Registry::set('gtap', $resource->getDb('gtap'));
    Zend_Registry::set('phpbb', $resource->getDb('phpbb'));
}

加载后,出现此错误:

致命错误:在非对象上调用成员函数 init() /var/www/gamebowl3/application/Bootstrap.php 第 105 行

我的 php.ini 在 include_path: 上有此条目:

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

并且我可以看到 multidb.php 位于:

/etc/apache2/librarties/Zend/Application/Resource

有人能告诉我导致错误的原因吗?谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

池予 2024-12-19 15:56:23

我刚刚发现问题出在application.ini中。在常用配置集中添加了新引入的设置。如下:

;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 Library 并将其添加到 PHP 的包含路径中。那应该可以解决所有问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文