Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005

    not able to connect to postgres

    i have written a small php code. when i try to access it on webpage, its not showing.


    $dbconn = pg_connect("host=localhost port=5432 dbname=martha");
    echo pg_dbname();

    the log file message is ::

    [client] PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: \xec0\xd2\n\tIs the server running on host &quot;localhost&quot; and accepting\n\tTCP/IP connections on port 5432?\n. in /var/www/html/sample1.php on line 5
    [client] PHP Warning: pg_dbname(): No PostgreSQL link opened yet. in /var/www/html/sample1.php on line 7

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    I moved this to the programming forum instead.

    Anyhow, are you sure that the PG server is running at all? What happens if you try to connect to it with telnet, as follows (and that's a shell command, not PHP code)?
    telnet localhost 5432

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts