php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dinh at td dot es dot hac dot com
New email:
PHP Version: OS:

 

 [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;
}

PHP3 CONFIGURATION:
./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 \
        --with-config-file-path=/usr/local/etc/

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

When running the above php3 code by opening the URL
http://mandrake.es.hac.com/twig/test.php3, 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/pgsql.db.inc
  on line 35
  Error: Could not connect to database Failed!

Patches

Pull Requests

History

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 http://www.php.net/manual/html/ref.pgsql.html

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-2025 The PHP Group
All rights reserved.
Last updated: Tue May 13 12:01:27 2025 UTC