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

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

4 Answers 4

0

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

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

0

Try:

$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
-1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.