|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42398 pg_(p)connect produces uninformative error messages
Submitted: 2007-08-23 13:45 UTC Modified: 2013-08-06 22:37 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: webmaster at touchingvirus dot net Assigned: yohgaki (profile)
Status: Wont fix Package: PostgreSQL related
PHP Version: 5.2.3 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: webmaster at touchingvirus dot net
New email:
PHP Version: OS:


 [2007-08-23 13:45 UTC] webmaster at touchingvirus dot net
When connecting to a pgSQL server (I use 8.2) with a wrong username, password or port in the connection string, the error given is really uninformative to the user and actually suggests a problem with the postgreSQL server:

"Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request."

The server didn't terminate & the connection was refused/aborted

Expected result:
To be honest, I expected an error that was similar to that of mySQL - though I know that is because mySQL actually produces good error messages =)


Access denied for: root@localhost (Using Password: YES)

The psql binary errors with the expect errors like:

psql: FATAL:  password authentication failed for user "root"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:09 UTC]
-Package: Feature/Change Request +Package: PostgreSQL related
 [2012-03-29 10:00 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: yohgaki
 [2013-08-06 22:37 UTC]
-Status: Assigned +Status: Wont fix
 [2013-08-06 22:37 UTC]
This is because PostgreSQL library set these uninformative error message.

php > $db = pg_connect('host= user=postgres password=dummy');

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect 
to server: Connection refused
	Is the server running on host "" and accepting
	TCP/IP connections on port 5432? in php shell code on line 1
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 03:03:38 2021 UTC