RE: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Dave Brunberg
I'd suggest building a connection string, explicitly defining the user and
password.  Maybe it would give you a more descriptive error that way
(invalid user, etc.).

The other thing I've done is do something like this:

$database = pg_connect ($conn_string)
or die (Help! No connection to the database! Error:  .
pg_last_error());


That may give you some more diagnostic info?

dwb
 -Original Message-
 From: Nathaniel Price [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 2:05 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Connection issues with pgsql?
 
 
 Hi, I just installed PHP with pgsql support, and it doesn't 
 seem to work
 properly, although I don't see why it shouldn't.
 
 I'm running the following script:
 ?php
 error_reporting (E_ALL);
 $myconn = pg_connect(dbname=thornvalley);
 $res = pg_query('select * from test;', $myconn);
 print_r(pg_fetch_row($res));
 ?
 
 and this is what I get back:
 Warning: pg_query(): supplied argument is not a valid PostgreSQL link
 resource in /var/www/html/dbtest.php on line 4
 
 Warning: pg_fetch_row(): supplied argument is not a valid 
 PostgreSQL result
 resource in /var/www/html/dbtest.php on line 5
 
 without any other clues as to what might be happening. I have 
 tried using
 other connection strings as well:
 dbname=thornvalley user=apache password=[passwd]
 dbname=thornvalley user=apache password=[passwd] 
 host=localhost port=5432
 
 with the same result.
 
 I'm not sure what's going on; just so that you know, I'm 
 using the RPM-based
 install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that 
 comes with
 Mandrake Linux 9.1. All of the necessary support packages 
 (AFAIK) have been
 installed and are visible with phpinfo() (i.e. there's a 
 pgsql section), and
 I have defined an apache user in the PostgreSQL database... 
 so, any clues as
 to what might be going on?
 
 
 Nathaniel Price http://www.thornvalley.com
 Who is General Failure and why is he reading my hard drive?
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Nathaniel Price
As I said in my first post, I tried the following connection strings as
well:
dbname=thornvalley user=apache password=[passwd]
dbname=thornvalley user=apache password=[passwd] host=localhost port=5432

and had the same results. After messing around with pg_hba.conf (I set local
authentication to 'password' instead of 'ident', I was able to get an error
message /when I used the wrong password/:

Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL
server: FATAL: Password authentication failed for user apache . in
/var/www/html/dbtest.php on line 3
error

If I used the correct password, that message would not appear. Furthermore,
when I added the line
echo $myconn = .$myconn;
to my script after pg_connect(), I would get:

$myconn = Resource id #2

which suggessts to me that it is successful in connecting to the db server,
but, for some reason PHP is unable to use the connection after that. Like I
said, it's weird. I have no idea why it's doing that.

- Original Message -
From: Dave Brunberg [EMAIL PROTECTED]
To: 'Nathaniel Price' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 12:24 PM
Subject: RE: [PHP-DB] Connection issues with pgsql?


 I'd suggest building a connection string, explicitly defining the user and
 password.  Maybe it would give you a more descriptive error that way
 (invalid user, etc.).

 The other thing I've done is do something like this:

 $database = pg_connect ($conn_string)
 or die (Help! No connection to the database! Error:  .
 pg_last_error());


 That may give you some more diagnostic info?

 dwb
  -Original Message-
  From: Nathaniel Price [mailto:[EMAIL PROTECTED]
  Sent: Friday, March 28, 2003 2:05 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Connection issues with pgsql?
[snip]
  I have
  tried using
  other connection strings as well:
  dbname=thornvalley user=apache password=[passwd]
  dbname=thornvalley user=apache password=[passwd]
  host=localhost port=5432
 
  with the same result.


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



RE: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Jennifer Goodie
Check the documentation on pg_query.
http://www.php.net/manual/en/function.pg-query.php

It expects the link identifier as the first argument and the query as the
second.  Switch your arguments and you might have some luck.

The manual is always a great place to look for answers to things like this.

-Original Message-
From: Nathaniel Price [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 11:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connection issues with pgsql?


Hi, I just installed PHP with pgsql support, and it doesn't seem to work
properly, although I don't see why it shouldn't.

I'm running the following script:
?php
error_reporting (E_ALL);
$myconn = pg_connect(dbname=thornvalley);
$res = pg_query('select * from test;', $myconn);
print_r(pg_fetch_row($res));
?

and this is what I get back:
Warning: pg_query(): supplied argument is not a valid PostgreSQL link
resource in /var/www/html/dbtest.php on line 4

Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result
resource in /var/www/html/dbtest.php on line 5

without any other clues as to what might be happening. I have tried using
other connection strings as well:
dbname=thornvalley user=apache password=[passwd]
dbname=thornvalley user=apache password=[passwd] host=localhost port=5432

with the same result.

I'm not sure what's going on; just so that you know, I'm using the RPM-based
install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with
Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been
installed and are visible with phpinfo() (i.e. there's a pgsql section), and
I have defined an apache user in the PostgreSQL database... so, any clues as
to what might be going on?


Nathaniel Price http://www.thornvalley.com
Who is General Failure and why is he reading my hard drive?


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


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



RE: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Dave Brunberg
Sorry for not fully reading your post.  That's what I get 4 spd rdng.

Just another WAG--have you tried using get_resource_type() on $myconn?
That may tell you whether the thing exists after its creation, and if it
does, it should tell you pgsql link as the resource type.  I'd suspect
that if it doesn't know the type that the postgresql interface is not
enabled.

Again, sorry for shooting from the hip with the first answer.

dwb

 -Original Message-
 From: Nathaniel Price [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 4:23 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Connection issues with pgsql?
 
 
 As I said in my first post, I tried the following connection 
 strings as
 well:
 dbname=thornvalley user=apache password=[passwd]
 dbname=thornvalley user=apache password=[passwd] 
 host=localhost port=5432
 
 and had the same results. After messing around with 
 pg_hba.conf (I set local
 authentication to 'password' instead of 'ident', I was able 
 to get an error
 message /when I used the wrong password/:
 
 Warning: pg_connect() [function.pg-connect]: Unable to 
 connect to PostgreSQL
 server: FATAL: Password authentication failed for user apache . in
 /var/www/html/dbtest.php on line 3
 error
 
 If I used the correct password, that message would not 
 appear. Furthermore,
 when I added the line
 echo $myconn = .$myconn;
 to my script after pg_connect(), I would get:
 
 $myconn = Resource id #2
 
 which suggessts to me that it is successful in connecting to 
 the db server,
 but, for some reason PHP is unable to use the connection 
 after that. Like I
 said, it's weird. I have no idea why it's doing that.
 
 - Original Message -
 From: Dave Brunberg [EMAIL PROTECTED]
 To: 'Nathaniel Price' [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 12:24 PM
 Subject: RE: [PHP-DB] Connection issues with pgsql?
 
 
  I'd suggest building a connection string, explicitly 
 defining the user and
  password.  Maybe it would give you a more descriptive error that way
  (invalid user, etc.).
 
  The other thing I've done is do something like this:
 
  $database = pg_connect ($conn_string)
  or die (Help! No connection to the database! Error:  .
  pg_last_error());
 
 
  That may give you some more diagnostic info?
 
  dwb
   -Original Message-
   From: Nathaniel Price [mailto:[EMAIL PROTECTED]
   Sent: Friday, March 28, 2003 2:05 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] Connection issues with pgsql?
 [snip]
   I have
   tried using
   other connection strings as well:
   dbname=thornvalley user=apache password=[passwd]
   dbname=thornvalley user=apache password=[passwd]
   host=localhost port=5432
  
   with the same result.
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Nathaniel Price
OOPS! /me hangs head in shame...

That's what it was. Guess that's what I get for always using PHPlib's
abstraction layer... I hardly ever use the actual pg_*() functions anymore.
Thanks for putting up with me. ;)


Nathaniel Price http://www.thornvalley.com
Who is General Failure and why is he reading my hard drive?

- Original Message -
From: Jennifer Goodie [EMAIL PROTECTED]
To: Nathaniel Price [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 1:27 PM
Subject: RE: [PHP-DB] Connection issues with pgsql?


 Check the documentation on pg_query.
 http://www.php.net/manual/en/function.pg-query.php

 It expects the link identifier as the first argument and the query as the
 second.  Switch your arguments and you might have some luck.

 The manual is always a great place to look for answers to things like
this.

 -Original Message-
 From: Nathaniel Price [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 11:05 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Connection issues with pgsql?


 Hi, I just installed PHP with pgsql support, and it doesn't seem to work
 properly, although I don't see why it shouldn't.

 I'm running the following script:
 ?php
 error_reporting (E_ALL);
 $myconn = pg_connect(dbname=thornvalley);
 $res = pg_query('select * from test;', $myconn);
 print_r(pg_fetch_row($res));
 ?

 and this is what I get back:
 Warning: pg_query(): supplied argument is not a valid PostgreSQL link
 resource in /var/www/html/dbtest.php on line 4

 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL
result
 resource in /var/www/html/dbtest.php on line 5

 without any other clues as to what might be happening. I have tried using
 other connection strings as well:
 dbname=thornvalley user=apache password=[passwd]
 dbname=thornvalley user=apache password=[passwd] host=localhost port=5432


 with the same result.

 I'm not sure what's going on; just so that you know, I'm using the
RPM-based
 install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with
 Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have
been
 installed and are visible with phpinfo() (i.e. there's a pgsql section),
and
 I have defined an apache user in the PostgreSQL database... so, any clues
as
 to what might be going on?

 
 Nathaniel Price http://www.thornvalley.com
 Who is General Failure and why is he reading my hard drive?


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


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





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