Re: BUG #2364: DB Error: connect failed ... PHP/PostgreSql

From: Jim Nasby <jnasby(at)pervasive(dot)com>
To: manashi <manashi_130582(at)rediffmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2364: DB Error: connect failed ... PHP/PostgreSql
Date: 2006-04-03 16:22:34
Message-ID: 5C504F93-8426-4CAB-9503-ADEB7FD0D1B4@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I fail to see how this is a bug, but...

Are you running the webserver as root? Most systems don't do that
(for good reason!). You should turn on log_connections and
log_disconnections in postgresql.conf and see what it shows is
happening (you might need to turn up log_min_messages).

On Mar 30, 2006, at 1:08 PM, manashi wrote:

>
> The following bug has been logged online:
>
> Bug reference: 2364
> Logged by: manashi
> Email address: manashi_130582(at)rediffmail(dot)com
> PostgreSQL version: psql (PostgreSQ
> Operating system: Linux
> Description: DB Error: connect failed ... PHP/PostgreSql
> Details:
>
> hi...
> I am working on PHP using postgreSQl as DB...
> Both r very new to me....
> i logged in as root and
> created a user root
> the command i hav used : createuser root
> and
> database sample : createdb sample
> then to check list of database i used command : psql -l
> the RESULT was
>
> List of databases
> Name | Owner | Encoding
> -----------+----------+----------
> sample | root | UNICODE
> template0 | postgres | UNICODE
> template1 | postgres | UNICODE
> (3 rows)
>
> then i created a table in DB sample name "login"
>
> using normal sql query and inserted two datas
>
> i created file "show.php" to display the content on web page
> the code is as follows :-
>
> <?php
> include("DB.php");
>
> $username = "root";
> $password = "";
> $hostname = "localhost";
> $dbname = "sample";
>
> $dsn = "pgsql://$username:$password(at)$hostname/$dbname";
> echo "The DSN : $dsn<br>";
>
> $con = DB::connect($dsn);
> echo "The Connection Object : $con<br>";
>
> if(DB::isError($con))
> {
> $valu = DB::isError($con);
> echo "Error Number : $valu <br>";
>
> $val1 = $con->getMessage($valu);
> echo "The Message : $val1<br>";
> }
> else
> {
> echo "Connection established <br>";
> }
>
> $sql="SELECT id,name FROM login";
> echo "$sql<br>";
>
> echo "$rs = $con->query($sql);";
> echo "$rs<br>";
>
> if(DB::isError($rs))
> {
> die($rs->getMessage());
> }
>
> while($row = $rs->fetchRow(DB_FETCHMODE_ASSOC))
> {
> $fulid = $row['id']." ";
> $fulname = $row['name']." ";
> echo "Details : $fulid $fulname<br>";
> }
> $con->disconnect();
> ?>
>
> i created a directory name example in /var/www/html
> and saved show.php there....
>
> when i am executing this file as
>
> http://localhost/example/show.php
>
> its displaying :
>
> The DSN : pgsql://root:@localhost/sample
> The Connection Object : Object id #2
> Error Number : 1
> The Message : DB Error: connect failed
> SQL QUERY : SELECT id,name FROM login
>
> i hav tried a lot to find out the error but unable to find it
>
> PostgreSQL version installed in my system :
> psql (PostgreSQL) 8.0.3
> contains support for command-line editing
>
> PHP version installed in my system :
> PHP 5.0.4 (cli) (built: May 9 2005 11:21:11)
> Copyright (c) 1997-2004 The PHP Group
> Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
>
> Operating System : LINUX
>
> Waiting for the REply...
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jim Nasby 2006-04-03 16:25:52 Re: BUG #2365: can't install
Previous Message Brock Peabody 2006-04-03 14:05:00 BUG #2371: database crashes with semctl failed error