1

Hi I just want to clear the question in my mind. I got an error

   Unable to connect to your database server using the provided settings.
   Filename: core/Loader.php
   Line Number: 346

after reading some of issue about that error I try to set $db['default']['db_debug'] = TRUE; to $db['default']['db_debug'] = FALSE; and it works!

as I read this in manual of CI Database Configuration

db_debug - TRUE/FALSE (boolean) - Whether database errors should be displayed.

I want to know that does really fix the problem or hiding not the error, but if it only hiding it how come it works? I am worried that it may cause future problem.

same question exist here.

any information and ideas is big help and well appreciated.Many Thanks!

Community
  • 1
  • 1
CaffeineShots
  • 2,172
  • 7
  • 33
  • 58
  • Is that an error or notice? – Jerin K Alexander Jun 05 '13 at 05:21
  • Did you try checking the logs or using `var_dump` on `$db` to see any error messages? You'll need messages to diagnose and fix the problem. – Ben Jun 05 '13 at 05:22
  • @jerin "A Database Error Occurred Unable to connect to your database server using the provided settings." it does not mention, I thinks it not Apache error – CaffeineShots Jun 05 '13 at 05:25
  • @steve I try to check it later. Now it fixed I just set debug to false, and it seems to work normally. – CaffeineShots Jun 05 '13 at 05:27
  • if the functionality is working, it will be a notice or warning.Can you paste the full content in the error message? – Jerin K Alexander Jun 05 '13 at 05:27
  • @Jerin yeah functionality's fine it is working, this is the full message prompt `Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346` – CaffeineShots Jun 05 '13 at 05:29
  • @kodewrecker - I didn't notice that you had posted the error, sorry. Anyway I'd still recommend checking the logs, it's surprisingly entertaining. – Ben Jun 05 '13 at 05:32
  • @Steve it ok, yeah that is my plan will check it.I just don't want to settle that it is working, I want to know how.maybe some will answer it.(^_^) thanks anyway. – CaffeineShots Jun 05 '13 at 05:36
  • is it possible that you are connecting to the database directly in your code - which is working - and the settings in application/config/database.php are wrong - which is why you are getting the error?? – Kinjal Dixit Jun 05 '13 at 08:21
  • @BinaryNights I think no, I am using MCV codeigniter and all I need to alter to connect to database is the database.php of Codeigniter – CaffeineShots Jun 05 '13 at 09:07
  • check this link http://stackoverflow.com/questions/7254049/codeigniter-unable-to-connect-to-your-database-server-using-the-provided-settin – miya Nov 06 '14 at 05:06

3 Answers3

2

Try to $db['default']['pconnect'] = TRUE; set to false rather than $db['default']['db_debug'] = TRUE;

Furkat U.
  • 431
  • 5
  • 20
0

I found why. In my situation, database error because my mysql config in php.ini is not right.

CI works well after I set mysql config in php.ini, like this:

[Mysql]
mysql.default_socket = /tmp/mysql.sock

If you didn't configure php.ini, the default socket is /var/mysql/mysql.sock, please check it.

I also set $db['default']['db_debug] to FALSE before, it looks ok, but no. It's just hide the error of mysql config, when I test to read from tables of mysql, I got nothing and didn't know why nothing. So I debug it, i found because my mysql connection was not established. :(

Sheppard Y
  • 101
  • 1
  • 5
0

Its worked for me

$db['default']['pconnect'] = FALSE;
vikram eklare
  • 800
  • 7
  • 25