pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Authentication Failure with pg_pconnect
5+ messages / 5 participants
[nested] [flat]

* Authentication Failure with pg_pconnect
@ 2003-08-18 17:30 dash@www.rogue-penguin.com
  2003-08-18 23:12 ` Re: Authentication Failure with pg_pconnect David Busby <busby@pnts.com>
  2003-08-19 08:05 ` Re: Authentication Failure with pg_pconnect Gerd Terlutter <gerd@MplusB.de>
  2003-08-19 15:50 ` Re: Authentication Failure with pg_pconnect scott.marlowe <scott.marlowe@ihs.com>
  0 siblings, 3 replies; 5+ messages in thread

From: dash@www.rogue-penguin.com @ 2003-08-18 17:30 UTC (permalink / raw)
  To: pgsql-php

I'm trying to get phpBB (php Bulletin Board System) running on my website
but it's install program is having problems authenticating with
postgreSQL.  I've tried to find out why it won't work and have pretty much
narrowed things down to this one function in the install script.  If the
following function doesn't seem flawed in any way, does anyone know why
php my throw this error even though username and password is correct and
user is logging in from localhost:

----
 Warning: pg_connect() [function.pg-connect]: Unable to connect to
PostgreSQL server: FATAL 1: IDENT authentication failed for user
"postgres" . in /var/www/html/phpBB2/db/postgres7.php on line 79
phpBB : Critical Error

Could not connect to the database
----

The line 79 it refers to is the line with the pg_pconnect call in the
following function:

----
	var $db_connect_id;
	var $query_result;
	var $in_transaction = 0;
	var $row = array();
	var $rowset = array();
	var $rownum = array();
	var $num_queries = 0;

	//
	// Constructor
	//
	function sql_db($sqlserver, $sqluser, $sqlpassword, $database,
$persistency = true)
	{
		$this->connect_string = "";

		if( $sqluser )
		{
			$this->connect_string .= "user=$sqluser ";
		}

		if( $sqlpassword )
		{
			$this->connect_string .= "password=$sqlpassword ";
		}

		if( $sqlserver )
		{
			if( ereg(":", $sqlserver) )
			{
				list($sqlserver, $sqlport) = split(":", $sqlserver);
				$this->connect_string .= "host=$sqlserver port=$sqlport ";
			}
			else
			{
				if( $sqlserver != "localhost" )
				{
					$this->connect_string .= "host=$sqlserver ";
				}
			}
		}

		if( $database )
		{
			$this->dbname = $database;
			$this->connect_string .= "dbname=$database";
		}

		$this->persistency = $persistency;

		$this->db_connect_id = ( $this->persistency ) ?
pg_pconnect($this->connect_string) : pg_connect($this->connect_string);

		return ( $this->db_connect_id ) ? $this->db_connect_id : false;
	}
---------


PLEASE give me a hand here, at least point me towards people who might
know more.  I need to figure this out.

A. Leigh
dash@rogue-penguin.com






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Authentication Failure with pg_pconnect
  2003-08-18 17:30 Authentication Failure with pg_pconnect dash@www.rogue-penguin.com
@ 2003-08-18 23:12 ` David Busby <busby@pnts.com>
  2 siblings, 0 replies; 5+ messages in thread

From: David Busby @ 2003-08-18 23:12 UTC (permalink / raw)
  To: dash@melchior.rogue-penguin.com; pgsql-php

this doc has something for you in the "notes" section.
http://www.edoceo.com/liberum/?doc=postgresql


----- Original Message ----- 
From: <dash@melchior.rogue-penguin.com>
To: <pgsql-php@postgresql.org>
Sent: Monday, August 18, 2003 10:30
Subject: [PHP] Authentication Failure with pg_pconnect


> I'm trying to get phpBB (php Bulletin Board System) running on my website
> but it's install program is having problems authenticating with
> postgreSQL.  I've tried to find out why it won't work and have pretty much
> narrowed things down to this one function in the install script.  If the
> following function doesn't seem flawed in any way, does anyone know why
> php my throw this error even though username and password is correct and
> user is logging in from localhost:
>
> ----
>  Warning: pg_connect() [function.pg-connect]: Unable to connect to
> PostgreSQL server: FATAL 1: IDENT authentication failed for user
> "postgres" . in /var/www/html/phpBB2/db/postgres7.php on line 79
> phpBB : Critical Error
>
> Could not connect to the database
> ----
>
> The line 79 it refers to is the line with the pg_pconnect call in the
> following function:
>
> ----
> var $db_connect_id;
> var $query_result;
> var $in_transaction = 0;
> var $row = array();
> var $rowset = array();
> var $rownum = array();
> var $num_queries = 0;
>
> //
> // Constructor
> //
> function sql_db($sqlserver, $sqluser, $sqlpassword, $database,
> $persistency = true)
> {
> $this->connect_string = "";
>
> if( $sqluser )
> {
> $this->connect_string .= "user=$sqluser ";
> }
>
> if( $sqlpassword )
> {
> $this->connect_string .= "password=$sqlpassword ";
> }
>
> if( $sqlserver )
> {
> if( ereg(":", $sqlserver) )
> {
> list($sqlserver, $sqlport) = split(":", $sqlserver);
> $this->connect_string .= "host=$sqlserver port=$sqlport ";
> }
> else
> {
> if( $sqlserver != "localhost" )
> {
> $this->connect_string .= "host=$sqlserver ";
> }
> }
> }
>
> if( $database )
> {
> $this->dbname = $database;
> $this->connect_string .= "dbname=$database";
> }
>
> $this->persistency = $persistency;
>
> $this->db_connect_id = ( $this->persistency ) ?
> pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
>
> return ( $this->db_connect_id ) ? $this->db_connect_id : false;
> }
> ---------
>
>
> PLEASE give me a hand here, at least point me towards people who might
> know more.  I need to figure this out.
>
> A. Leigh
> dash@rogue-penguin.com
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Authentication Failure with pg_pconnect
  2003-08-18 17:30 Authentication Failure with pg_pconnect dash@www.rogue-penguin.com
@ 2003-08-19 08:05 ` Gerd Terlutter <gerd@MplusB.de>
  2 siblings, 0 replies; 5+ messages in thread

From: Gerd Terlutter @ 2003-08-19 08:05 UTC (permalink / raw)
  To: dash@www.rogue-penguin.com; +Cc: pgsql-php

dash@www.rogue-penguin.com wrote:
> I'm trying to get phpBB (php Bulletin Board System) running on my website
> but it's install program is having problems authenticating with
> postgreSQL.  I've tried to find out why it won't work and have pretty much
> narrowed things down to this one function in the install script.  If the
> following function doesn't seem flawed in any way, does anyone know why
> php my throw this error even though username and password is correct and
> user is logging in from localhost:
> 
> ----
>  Warning: pg_connect() [function.pg-connect]: Unable to connect to
> PostgreSQL server: FATAL 1: IDENT authentication failed for user
> "postgres" . in /var/www/html/phpBB2/db/postgres7.php on line 79
> phpBB : Critical Error
> 
> Could not connect to the database
> ----
> 
> The line 79 it refers to is the line with the pg_pconnect call in the
> following function:
> 
> ----
> 	var $db_connect_id;
> 	var $query_result;
> 	var $in_transaction = 0;
> 	var $row = array();
> 	var $rowset = array();
> 	var $rownum = array();
> 	var $num_queries = 0;
> 
> 	//
> 	// Constructor
> 	//
> 	function sql_db($sqlserver, $sqluser, $sqlpassword, $database,
> $persistency = true)
> 	{
> 		$this->connect_string = "";
> 
> 		if( $sqluser )
> 		{
> 			$this->connect_string .= "user=$sqluser ";
> 		}
> 
> 		if( $sqlpassword )
> 		{
> 			$this->connect_string .= "password=$sqlpassword ";
> 		}
> 
> 		if( $sqlserver )
> 		{
> 			if( ereg(":", $sqlserver) )
> 			{
> 				list($sqlserver, $sqlport) = split(":", $sqlserver);
> 				$this->connect_string .= "host=$sqlserver port=$sqlport ";
> 			}
> 			else
> 			{
> 				if( $sqlserver != "localhost" )
> 				{
> 					$this->connect_string .= "host=$sqlserver ";
> 				}
> 			}
> 		}
> 
> 		if( $database )
> 		{
> 			$this->dbname = $database;
> 			$this->connect_string .= "dbname=$database";
> 		}
> 
> 		$this->persistency = $persistency;
> 
> 		$this->db_connect_id = ( $this->persistency ) ?
> pg_pconnect($this->connect_string) : pg_connect($this->connect_string);
> 
> 		return ( $this->db_connect_id ) ? $this->db_connect_id : false;
> 	}
> ---------
> 
> 
> PLEASE give me a hand here, at least point me towards people who might
> know more.  I need to figure this out.
> 
> A. Leigh
> dash@rogue-penguin.com
> 
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

have you tried echo $this->connect_string ?

-- 
--------------------------------------------------------
# Gerd Terlutter        | Mueller+Blanck Software GmbH #
# gerd@MplusB.de        | Gutenbergring 38             #
# gerd.terlutter@web.de | D-22848 Noderstedt           #
# tel:0171/6992579      | tel:+49 40 500 171-1         #
# Buero:040/500171-17   | fax:+49 40 500 171-71        #
--------------------------------------------------------





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Authentication Failure with pg_pconnect
  2003-08-18 17:30 Authentication Failure with pg_pconnect dash@www.rogue-penguin.com
@ 2003-08-19 15:50 ` scott.marlowe <scott.marlowe@ihs.com>
  2003-08-19 16:03   ` Re: Authentication Failure with pg_pconnect Bruno Wolff III <bruno@wolff.to>
  2 siblings, 1 reply; 5+ messages in thread

From: scott.marlowe @ 2003-08-19 15:50 UTC (permalink / raw)
  To: dash@melchior.rogue-penguin.com; +Cc: pgsql-php

On Mon, 18 Aug 2003 dash@melchior.rogue-penguin.com wrote:

> I'm trying to get phpBB (php Bulletin Board System) running on my website
> but it's install program is having problems authenticating with
> postgreSQL.  I've tried to find out why it won't work and have pretty much
> narrowed things down to this one function in the install script.  If the
> following function doesn't seem flawed in any way, does anyone know why
> php my throw this error even though username and password is correct and
> user is logging in from localhost:
> 
> ----
>  Warning: pg_connect() [function.pg-connect]: Unable to connect to
> PostgreSQL server: FATAL 1: IDENT authentication failed for user
> "postgres" . in /var/www/html/phpBB2/db/postgres7.php on line 79
> phpBB : Critical Error

Stop, do not pass go, do not collect $200.00

Note the error is that "IDENT authentication failed"

Look up ident authentication:

http://www.postgresql.org/docs/7.3/static/auth-methods.html#AUTH-IDENT

Note that the username of the client (in this case, likely either httpd or 
nobody) is what postgresql inspects.  your connection string doesn't 
matter since postgresql is now looking for a user account by the name of 
whatever user your web server runs under.

http://www.postgresql.org/docs/7.3/static/auth-methods.html

tells us the ways to authenticate, and you're likely looking at using 
trust, password, md5.

md5 is a good choice, or, if no one else will be writing apps on the 
machine, trust is fast, but there's no actual authentication going on with 
that method.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Authentication Failure with pg_pconnect
  2003-08-18 17:30 Authentication Failure with pg_pconnect dash@www.rogue-penguin.com
  2003-08-19 15:50 ` Re: Authentication Failure with pg_pconnect scott.marlowe <scott.marlowe@ihs.com>
@ 2003-08-19 16:03   ` Bruno Wolff III <bruno@wolff.to>
  0 siblings, 0 replies; 5+ messages in thread

From: Bruno Wolff III @ 2003-08-19 16:03 UTC (permalink / raw)
  To: scott.marlowe <scott.marlowe@ihs.com>; +Cc: dash@melchior.rogue-penguin.com; pgsql-php

On Tue, Aug 19, 2003 at 09:50:33 -0600,
  "scott.marlowe" <scott.marlowe@ihs.com> wrote:
> 
> Note that the username of the client (in this case, likely either httpd or 
> nobody) is what postgresql inspects.  your connection string doesn't 
> matter since postgresql is now looking for a user account by the name of 
> whatever user your web server runs under.

This isn't exactly true. The id given in the connection string is
the one that is to be used for the postgres connection. The username of
the client is checked to see if it is an allowed system user for the
postgres user. It is common to force them to match, but other options
are possible.



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-08-19 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-18 17:30 Authentication Failure with pg_pconnect dash@www.rogue-penguin.com
2003-08-18 23:12 ` David Busby <busby@pnts.com>
2003-08-19 08:05 ` Gerd Terlutter <gerd@MplusB.de>
2003-08-19 15:50 ` scott.marlowe <scott.marlowe@ihs.com>
2003-08-19 16:03   ` Bruno Wolff III <bruno@wolff.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox