I need to connet a remote PostgreSQL database in Codeigniter 3 web site. The database configuration in CI 3 is the following:
$db['postgres'] = array(
'dsn' => '',
'hostname' => 'simbywire.org',
'username' => 'postgres',
'password' => 'xxxxxxx',
'database' => 'aeroclub',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE,
'port' => 5432,
);
I have enabled the PHP modules PGSQL and PDO_PGSQL
I get the following error trying to connect to the db:
Message: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "simbywire.org" (176.58.111.4) and accepting TCP/IP connections on port 5432?
Filename: postgre/postgre_driver.php
If I try to connect to the remote server using pgAdmin I can succesfully get into it...so I'm sure about the server name, username and password.
Any help or idea to fix the issue? Thanks a lot
EDIT: The following command on remote PostgreSQL server
sudo netstat -ltnp | grep postgres
produced the following result:
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 756/postgres
tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN 754/postgres
tcp 0 0 127.0.0.1:5434 0.0.0.0:* LISTEN 755/postgres
tcp6 0 0 :::5432 :::* LISTEN 756/postgres