diff --git a/include/config_file.php b/include/config_file.php
index 9e2a45371..12891321f 100644
--- a/include/config_file.php
+++ b/include/config_file.php
@@ -116,6 +116,8 @@ function config_file_create($p_array,$from_setup=1,$os=1) {
fputs($hFile,"\n\r");
fputs($hFile, 'define ("phpcompta_psql_port","'.$cport.'");');
fputs($hFile,"\n\r");
+ fputs($hFile, 'define ("phpcompta_psql_host","127.0.0.1");');
+ fputs($hFile,"\n\r");
fputs($hFile, 'define ("domaine","");');
fputs($hFile,"\n\r");
fputs($hFile,'?>');
diff --git a/include/postgres.php b/include/postgres.php
index e4faeaf8f..a3a5866a3 100644
--- a/include/postgres.php
+++ b/include/postgres.php
@@ -101,8 +101,9 @@ function DbConnect($p_db=-1,$p_type='dossier') {
$phpcompta_user=phpcompta_user;
$password=phpcompta_password;
$port=phpcompta_psql_port;
+ $host=( ! defined ("phpcompta_psql_host"))?'127.0.0.1':phpcompta_psql_host;
ob_start();
- $a=pg_connect("dbname=$l_dossier host=127.0.0.1 user='$phpcompta_user'
+ $a=pg_connect("dbname=$l_dossier host='$host' user='$phpcompta_user'
password='$password' port=$port");
if ( $a == false )
@@ -115,6 +116,7 @@ password='$password' port=$port");
echo "Domaine : ".domaine."
";
echo "Port $port
";
echo "Utilisateur : $phpcompta_user
";
+ echo "host : $host
";
exit ("Connection impossible : vérifiez vos paramètres de base
de données");