0

i am getting the following error :

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

Filename: core/Loader.php

Line Number: 346

my database.php is :

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'usertest';
$db['default']['password'] = '';
$db['default']['database'] = 'usertest';
$db['default']['port']     = '5433';
$db['default']['dbdriver'] = 'postgre';
$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;

What is the possible solution. I do not want to $db['default']['db_debug'] = FALSE; as even after doing this i am still not able to connect to db.

EDIT : Changed the port to 5432. still it doesnt work

  • Are you sure postgres is on port 5433? try telnet localhost 5433 from command line and see if you get a blank screen. – user20232359723568423357842364 Jul 16 '13 at 20:31
  • Same question, Posgres's default port is 5432. – Hieu Nguyen Jul 16 '13 at 21:50
  • "postgre"? I think you're missing an s – GordonM Jun 27 '18 at 14:38
0

Set Set $db['default']['pconnect'] = FALSE; and check once again.

| improve this answer | |
0

Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might require a full DSN string to be provided. If that is the case, you should use the ‘dsn’ configuration setting, as if you’re using the driver’s underlying native PHP extension, like this:

$db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';

from official documentation of codeigniter

| improve this answer | |
-1

Check your db driver name. I am pretty sure it is "postgres" and not "postgre."

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.