Well, I don't know specifics of postgresql, but I'll give it a whirl.


This function should give you the error about WHY it was unable to connect.
If not, check stuff like permissions, making sure pgsql.so (or whatever it
is named) is actually compiled in (use phpinfo() to determine, and looks
like you already confirmed that), make sure you are connecting to is
resolving in DNS if not localhost, and the user can connect to the DB set.

$dbconn3 = pg_connect ("host=sheep port=5432 dbname=mary user=lamb password=foo");

Also from the PHP manual site:

    A lot of the questions that appear here can be answered by looking at the
    PostgreSQL programming documentation (www.postgresql.org).  PHP's
    PostgreSQL interface appears to be heavily based on the libpq programming

    If you use PostgreSQL users for authenticating into your pg database
    rather than using your own authentication, always specify host
    directive in pg_connect and edit pg_hba.conf to authenticate from this
    host accordingly. Otherwise, PHP will connect as 'local' using UNIX
    domain sockets, which is set in pg_hba.conf to 'trust' by default (so
    you can connect using psql on console without specifying password) and
    everyone can connect to db _without password_ .


On Sun, 10 Nov 2002, Khee Wei wrote:

> Hi there,
> I got this fustrating problem with postgresql & php.... can any one help???
> my postgresql installation is working fine with my perl application.  My php
> is working fine... however, my php don't seems to be able to connect to the
> postgresql.  I always get the unable to connect error... anyone knows what's
> wrong???
> I'm using postgresql 7.2.2, php 4.2 and redhat 8.0.  I've added support for
> pgsql and I've confirm that pqsql.so is loaded.
> Pls help....
> Regards
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED]                             http://www.purplecow.com/

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to