Search code examples
codeigniteractiverecordmodelcontrollerhmvc

CodeIgniter Modular Extensions HMVC database error


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.


Solution

  • 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