I am trying to connect to PostgreSQL using Codeigniter framework. Now in my database.php
I have the following code :
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
'password' => '',
'database' => 'fmsdb',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
But When I run my site in localhost, I get following database error :
A PHP Error was encountered
Severity: Warning
Message: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Permission denied Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
Filename: postgre/postgre_driver.php
Line Number: 154
I tried putting this in my PostgreSQL.conf file :
listen_addresses = '*'
Where am I going wrong?
$db['default']['port'] = 5432;
also enabled the ext from php ini.extension=php_pdo_pgsql.dll