More than likely you haven't editied the pg_hba.conf file and the postgresql.conf file.
If you connect like this:
$conn = pg_connect("user=me dbname=big");
Then php will use local unix sockets. If you connect like this:
$conn = pg_connect("host=127.0.0.1 user=me dbname=big");
then php will connect with TCP/IP sockets.
In order for Postgresql to accept TCP/IP connections, you have to edit the postgresql.conf file and change the line that says
#tcpip_socket = false
to
tcpip_socket = true
If the machine is remote from the server you're on, then you'll also need to edit pg_hba.conf to allow remote connections. It's a self documenting file, pretty easy to figure out, just copy the host line at the bottom and change the IP in it.