Can anyone explain what going wrong here? I'm at a loss and the postgres mailing list hasn't come up with and answer.
Any sugestions for a fix or how to debug this would be greatly appreciated.
The message in the error_log is...
PHP Warning: pg_connect() [<a href='function.pg-connect'>function.pg-connect</a>]: Unable to connect to PostgreSQL server: could not connect to server: Permission denied\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432?
The PHP code is...
$dbconn=pg_connect( "dbname=lumbribase host=localhost port=5432 user=webuser" );
$dbconn=pg_connect(dbname=$PG_DATABASE);
if ( ! $dbconn ) {
echo "Error connecting to the database !<br> " ;
printf("%s", pg_errormessage( $dbconn ) );
exit(); }According to the postgres guy's "psql -h localhost lumbribase" means force postgres to use a TCP connection when making a local connection to postgres and that works fine. Perl scripts using DBD_PG connect fine. Why is postgres denying permission to connections made through PHP? It's not user or database specific. It would need to connect to the postgres server to check a users permissions but it's not getting that far.
This bit's I know are...
http://xyala.cap.ed.ac.uk/php_info.php say's php's configured for pgsql
the port is accepting TCP
[#@xyala]# telnet localhost 5432
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Connection closed by foreign host.
[#@xyala]#pg_hba.conf is currently set up to allow anyone in
[#@xyala]# less /var/lib/pgsql/data/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trustpostgres.conf is set to listen on all ports
[#@xyala]# grep 'listen' /var/lib/pgsql/data/postgresql.conf
# "pg_ctl reload". Some settings, such as listen_address, require
#listen_addresses = 'localhost' # what IP interface(s) to listen on;
listen_addresses = '*'
[#@xyala]#don't know what should be in this file but I can't think I've ever had to change it before.
[#@xyala]# less /etc/php.d/pgsql.ini
; Enable pgsql extension module
extension=pgsql.sothe server I'm going to replace is running the same versions of PHP and postgres
http://zeldia.cap.ed.ac.uk/php_info.phpThe /etc/php.ini files on the two machines are the same and the /var/lib/pgsql/data/postgresql.conf files are only different because I've set listen_addresses = '*' on the new server (xyala) to see if I can make it work.