|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1377 Can't connect to database
Submitted: 1999-05-05 13:01 UTC Modified: 1999-05-05 13:11 UTC
From: dinh at td dot es dot hac dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 3.0.7 OS: Linux 2.0.36
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
6 + 37 = ?
Subscribe to this entry?

 [1999-05-05 13:01 UTC] dinh at td dot es dot hac dot com
$db=pg_Connect('localhost', 5432,  "", "", 'twig');
if (! $db) {
  PrintError("Could not connect to database");
  return 0;

./configure --with-pgsql=/usr/local/pgsql  \
        --with-apache=/u/dinh/apache_1.3.6 \
        --enable-track-vars --with-imap=/u/dinh/imap-4.5 \
        --with-gd=/u/dinh/gd_1.3 --with-x --with-zlib \

I am able to connect to the Postgres database by running
   pgsql twig

When running the above php3 code by opening the URL, I received the following
error message:
  Warning: Unable to connect to PostgresSQL server: connectDB()
  failed: Is   the postmaster running and accepting TCP/IP(with -i)
  connections at  'localhost' on port '5432'? in features/
  on line 35
  Error: Could not connect to database Failed!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-05 13:11 UTC] sas at cvs dot php dot net
You are probably running into the problem which is outlined on

Starting the postmaster with -i should help. If you want to connect through the faster Unix socket instead of the TCP socket, replace "localhost" with "" and 5432 with "".
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 29 02:03:33 2022 UTC