note 38291 added to function.pg-connect
| From: | Cybertinus at rn2 dot php dot net | Date: | Mon, 15 Dec 2003 18:47:38 +0000 |
| Subject: | note 38291 added to function.pg-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62001@lists.php.net to get a copy of this message | ||
If you use pg_connect('host=localhost port=5432 user=my_username password=my_password
dbname=my_dbname') and you get the following error:
"Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server:
Connection refused Is the server running on host localhost and accepting TCP/IP connections on port
5432?"
then you should try to leave the host= and port= parts out of the connection string. This sounds
strange, but this is an "option" of Postgre. If you have not activated the TCP/IP port in
postgresql.conf then postgresql doesn't accept any incoming requests from an TCP/IP port. If
you use host= in your connection string you are going to connect to Postgre via TCP/IP, so
that's not going to work. If you leave the host= part out of your connection string you connect
to Postgre via the Unix domain sockets, which is faster and more secure, but you can't connect
with the database via any other PC as the localhost.
----
Manual Page -- http://www.php.net/manual/en/function.pg-connect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38291
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38291&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38291&report=yes
Search -- http://master.php.net/manage/user-notes.php