CodeIgniter 模块化扩展 HMVC 数据库错误

发布于 2024-12-21 02:13:20 字数 1437 浏览 3 评论 0原文

我安装了 CodeIgniter 最新版本和模块化扩展 HMVC Wiredesignz HMVC Bitbucket

它在我的服务器中显示令人讨厌的错误。如果我刷新同一页面 100 次,总刷新量的 5-10% 会显示此错误。

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: /Library/WebServer/Documents/modular/third_party/MX/Loader.php

Line Number: 96

错误屏幕截图

在此处输入图像描述 自动加载配置文件 ./autoload.php 中的代码。

$autoload['packages'] = array(APPPATH.'third_party');

$autoload['libraries'] = array('database');

数据库配置文件./database.php中的代码。

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '*****';
$db['default']['password'] = '*****';
$db['default']['database'] = '*****';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

希望我说清楚了。提前致谢。

I installed CodeIgniter latest version and Modular extension HMVC Wiredesignz HMVC Bitbucket.

It is showing annoying error in my server. If I refresh the same page for 100 times 5-10% of total refresh show this error.

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: /Library/WebServer/Documents/modular/third_party/MX/Loader.php

Line Number: 96

Screenshot of the Error

enter image description here
Code in Autoload Configuration file ./autoload.php.

$autoload['packages'] = array(APPPATH.'third_party');

$autoload['libraries'] = array('database');

Code in database configuration file ./database.php.

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '*****';
$db['default']['password'] = '*****';
$db['default']['database'] = '*****';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Hope I am clear. Thanks in advanced.

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

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

发布评论

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

评论(3

宁愿没拥抱 2024-12-28 02:13:20

尝试将这些属性之一或全部设置为 FALSE

$db['default']['pconnect'] = TRUE;

$db['default']['db_debug'] = TRUE;

Try setting one or both these attributes to FALSE:

$db['default']['pconnect'] = TRUE;

$db['default']['db_debug'] = TRUE;
九八野马 2024-12-28 02:13:20

这不是 HMVC 问题,当我更改主机时,它工作正常。某些主机或您的设置可能存在数据库服务器问题或文件权限问题。

Phil,HMVC 的作者在这里解释了

CodeIgniter 的 HMVC 模块化扩展的问题

It was not HMVC issue, when I change the host it is working perfectly. There might be some database server issue or file permission issue with some hosting or your settings.

Phil, Author of HMVC explained here

Trouble with HMVC modular extensions for CodeIgniter

一杯敬自由 2024-12-28 02:13:20

修改数据库用户密码
设置简单,如 mydb.123
并测试
就我而言,它有效

change password of database user
set it simple like mydb.123
and test
in my case it works

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