cannot connect to postgres through apache/browser? [SOLVED]

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
okie.floyd
Forum Newbie
Posts: 2
Joined: Thu Jul 01, 2010 9:17 am

cannot connect to postgres through apache/browser? [SOLVED]

Post by okie.floyd »

FC 12 linux, i have apache trying to connect to postgres.

when i try to execute stuff through the browser, i get a connection error (apache error: "could not connect to server: Permission denied. Is the server running on host "localhost" and accepting. TCP/IP connections on port 5432? in /path/to/file.php on line 29, referer: http://10.0.1.2/")

but when i execute a file from the shell (aka. [myuser@localhost ]#php file.php), it all works fine.

could something be wrong with the connectors in apache? i can connect fine from psql too.

thanks
Last edited by okie.floyd on Thu Jul 01, 2010 9:54 am, edited 1 time in total.
okie.floyd
Forum Newbie
Posts: 2
Joined: Thu Jul 01, 2010 9:17 am

Re: cannot connect to postgres through apache/browser?

Post by okie.floyd »

finally found the fix.

this is an SE Linux issue. need to enable network database connections for apache.

this command fixed the problem

# setsebool -P httpd_can_network_connect_db 1
Post Reply