Thread: php - pgsql connection

php - pgsql connection

From
Sebestyen Zoltan
Date:
Hi,

 I know it's not a PHP3 mailinglist but the question is somewhat related
to pgsql.
 I would like to know what's the problem with following line:
$dbConn = pg_Connect( "  host=$host  user=$user  password=$password port=$port dbname=$dbname");

 The php variables are filled with the appropriate values.
However, I always get the following error:

 Warning: Unable to connect to PostgresSQL server: connectDB() -- connect
() failed: Can't assign requested address Is the postmaster running (with
-i) at 'localhost' and accepting connections on TCP/IP port 'dbname='? in
/usr/users/szoli/public_html/guestbook.php3 on line 61

        Thanks in advance

--------------------------------------------------------------------------------
Sebestyén Zoltán <szoli@netvisor.hu>    I can't choose what I can't believe
                    That the way of life is to live and grieve
MAKE INSTALL NOT WAR            'cause I see living as a place in the sun
                    and the world as a place for a kingdom to come

I use UNIX because reboots are for hardware upgrades.

                 Kick me! Whip me!! Make me develop on AIX!!!


Re: [GENERAL] php - pgsql connection

From
"Aaron J. Seigo"
Date:
hi...

>  I would like to know what's the problem with following line:
> $dbConn = pg_Connect( "  host=$host  user=$user  password=$password port=$port dbname=$dbname");
>
>  The php variables are filled with the appropriate values.

are you sure?

>  Warning: Unable to connect to PostgresSQL server: connectDB() -- connect
> () failed: Can't assign requested address Is the postmaster running (with
> -i) at 'localhost' and accepting connections on TCP/IP port 'dbname='? in
                                                                     ^^^^^^^^^^^

my guess is that $port is not assigned. its trying to connect to port
'dbname=', which is actually the start of the next variable pair. $port should
have some numeric data in it, something like 5432...

--
Aaron J. Seigo
Sys Admin

Re: [GENERAL] php - pgsql connection

From
Sebestyen Zoltan
Date:
On Fri, 15 Oct 1999, Aaron J. Seigo wrote:

> hi...
>
> >  I would like to know what's the problem with following line:
> > $dbConn = pg_Connect( "  host=$host  user=$user  password=$password port=$port dbname=$dbname");
> >
> >  The php variables are filled with the appropriate values.
>
> are you sure?
Thank you very much! You were right, I somehow forgot to fill the 'port'
variable with the appropriate value.. I feel a bit dumb now :(

    Thanks again

--------------------------------------------------------------------------------
Sebestyén Zoltán <szoli@netvisor.hu>    I can't choose what I can't believe
                    That the way of life is to live and grieve
MAKE INSTALL NOT WAR            'cause I see living as a place in the sun
                    and the world as a place for a kingdom to come

I use UNIX because reboots are for hardware upgrades.

                 Kick me! Whip me!! Make me develop on AIX!!!