Pb to connect postgresql

help

#1

just after installation, impossible to have login html page

Server configuration
Operating system: cento7
Web server:apache
Database:postgresql
PHP version:php5.5
ownCloud version (see ownCloud admin page):9.1
fresh install
ownCloud log (data/owncloud.log)

HP Fatal error: Uncaught exception 'Doctrine\DBAL\DBALException' with message 'Failed to connect to the database: An exception occured in driver: SQLSTATE[08006] [7] could not connect to server: Permission denied\n\tIs the server running on host "localhost" (::1) and accepting\n\tTCP/IP connections on port 5432?\ncould not connect to server: Permission denied\n\tIs the server running on host "localhost" (127.0.0.1) and accepting\n\tTCP/IP connections on port 5432?' in /var/www/html/owncloud/lib/private/DB/Connection.php:58\nStack trace:\n#0 /var/www/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /var/www/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /var/www/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /var/www/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connect in /var/www/html/owncloud/lib/private/DB/Connection.php on line 58

config.php
'datadirectory' => '/opt/data',
'overwrite.cli.url' => 'http://localhost',
'dbtype' => 'pgsql',
'dbname' => 'owncloud',
'dbhost' => 'localhost:5432',
'dbtableprefix' => 'oc_',
'dbuser' => 'owncloud',
'dbpassword' => 'owncloud',
'logtimezone' => 'UTC',
'installed' => true,
'maintenance' => false,

hba.conf is ok i can connect with pgadmin from another server.

if you can help me


#2

Solved

even you use localhost on centos7 dbhost you have to use this slelinux

setsebool -P httpd_can_network_connect_db on


#3

Yes, thats described here:

https://doc.owncloud.org/server/latest/admin_manual/installation/selinux_configuration.html#allow-access-to-a-remote-database

Maybe "remote" is not that exactly but "localhost" is also a network connection in this case.