Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: PHP/postgreSQL



Can you try and  telnet to the box from your server on port 5432?

I don't have shell access to the webserver machine.  I can connect from one of
my local machines via: telnet 24.85.82.xxx 5432

It brings up an empty console that closes after I enter input.


Quoting "Gavin M. Roy" <gmr(at)ehpg(dot)net>:

Are you sure your isp isn't blocking access? First thought to come to mind is shaw cable might be blocking port 5432. Can you try and telnet to the box from your server on port 5432? Also check to make sure pgsql is listening on tcp/ip. Also if you're a home shaw customer, are you behind a nat router? Have you opened up access on the nat router to get to your box behind it?

HTH,

Gavin

On Feb 4, 2006, at 2:14 PM, vince(at)weaktight(dot)com wrote:

I'm running PHP/mySQL via a web hosting service. I require my PHP scripts to
access an external PostgreSQL database.

I have the PostgreSQL server setup to accept connections from anyone:
[pg_hba_conf]

# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 trust

[--]

I've tested this connection via pgAdminIII and I'm able to connect using this
IP, but when I try to connect via php from the hosted webpage...

My php script is simple:

<?php
$conn_string = "host=24.85.82.xxx port=5432 dbname=PGSQL1  user=postgres
password=xxx";

$dbconn = pg_connect($conn_string);

if ($dbconn) {

print "Successfully connected to: " . pg_host($dbconn) . "<br/>\n";

} else {

print pg_last_error($dbconn);
exit;
}

pg_close($dbconn);
?>

But I'm foiled by:

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Operation timed out Is the server running on host "24.85.82.xxx" and
accepting TCP/IP connections on port 5432? in
/usr/local/psa/home/vhosts/weaktight.com/httpdocs/mytest.php on  line 13

Any thoughts or suggestions would be greatly appreciated. I'm not very
experienced with any of this stuff.

Thanks.


---------------------------(end of  broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
      message can get through to the mailing list cleanly







Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group