Pergunta

I just installed bugzilla-4.4.1 on version 6.4 of Scientific Linux, and I'm having problems connecting to the database (Pg version 8.4).

When I try to fetch the main page (index.cgi), I get the following message:

Software error:

Can't connect to the database.
Error: could not connect to server: Permission denied
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?
  Is your database installed and up and running?
  Do you have the correct username and password selected in localconfig?

For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.

Postgres's pg_hba.conf.conf is configured for md5 auth on localhost:

host all all 127.0.0.1/32 md5

and I can connect to the bugs user in the database using psql:

psql -h 127.0.0.1 -U bugs

Running checksetup.pl seems to confirm that the database is set up and configured properly:

... snip ...

Reading ./localconfig...
Checking for               DBD-Pg (v2.7.0)    ok: found v2.15.1 
Checking for           PostgreSQL (v8.03.0000) ok: found v08.04.1800 

Removing existing compiled templates...
Precompiling templates...done.
Fixing file permissions...

Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.
checksetup.pl complete.
[root@PAHRALBLNX001 bugzilla]# 

and the testserver.pl script indicates that the server is set up properly:

[root@PAHRALBLNX001 bugzilla]# ./testserver.pl http://127.0.0.1/
TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
TEST-OK Webserver is preventing fetch of http://127.0.0.1/localconfig.

I've also verified that the bugs username and password in localconfig matches the setup in Postgres.

The one thing that seems odd however, is that when I look at localhost with Wireshark, I don't see any attempts to connect to the PostgreSQL server while accessing the bugzilla main page. However, if I connect to the PostgreSQL server using psql, I do see the connection in Wireshark.

Edit

I also discovered that bugzilla wouldn't send email. This turned out to be a selinux problem as pointed out by Daniel Vérité. I changed httpd_can_sendmail and httpd_can_network_connect to true, and now it works.

Foi útil?

Solução

Based on the error message:

Error: could not connect to server: Permission denied
Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

Permission denied when trying to connect to an IP address means it's denied by the local security policy. The web server must be enabled to connect to databases with this command:

setsebool -P httpd_can_network_connect_db 1

and if it's not sufficient:

setsebool -P httpd_can_network_connect 1

See http://wiki.centos.org/TipsAndTricks/SelinuxBooleans for more

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top