CodeIgniter 模块化扩展 HMVC 数据库错误
我安装了 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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试将这些属性之一或全部设置为
FALSE
:Try setting one or both these attributes to
FALSE
:这不是 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
修改数据库用户密码
设置简单,如 mydb.123
并测试
就我而言,它有效
change password of database user
set it simple like mydb.123
and test
in my case it works