• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Database Error!

Hi guys,

I am a bit of a novice PHP programmer and it's my first time using a PHP framework. As far as I'm finding it very helpful and convenient, I can't seem to get past a very simple hurdle. No matter how I configure my database settings I keep getting the same error:

Quote:Your application/config/database.php file does not appear to contain a valid configuration array.

My configuration settings are as follows

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

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'test';
$db['default']['database'] = 'test';
$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;

Can anyone pinpoint at the problem? I am certain the database access credentials are correct.

Anyone? Please help, this is driving me insane! All other scripts are working with the same credentials, have I missed out something in the other parts of the codeigniter configuration?

Your credentials should be what you setup MySQL for on your system!

Also make sure that you start MySQL or it will never work!

Also try truning off pconnect = FALSE

The Error is stating that the config file is wrong!

Check for white space before and after


Are you trying to manually load the database config? That error message is only called by $this->config->load()...?

Nevermind. Being a noob I added the database entry in the wrong autoload configuration, I put it in the config array instead of the library array! Now I no longer get the error message! Big Grin

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.