note 69963 added to ref.pdo

From: Date: Thu, 28 Sep 2006 06:38:02 +0000
Subject: note 69963 added to ref.pdo
Groups: php.notes 
Request: Send a blank email to php-notes+get-117762@lists.php.net to get a copy of this message
If you use $dbh = new PDO('pgsql:host=localhost;dbname=test_basic01', $user, $pass); and you get the following error: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] could not connect to server: Connection refused\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP connections on port 5432?' then as pointed out under pg_connect at: http://www.php.net/manual/en/function.pg-connect.php#38291 ****** 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. ****** Sincerely, Aouie ---- Server IP: 216.194.113.175 Probable Submitter: 69.229.172.82 ---- Manual Page -- http://www.php.net/manual/en/ref.pdo.php Edit -- https://master.php.net/note/edit/69963 Del: integrated -- https://master.php.net/note/delete/69963/integrated Del: useless -- https://master.php.net/note/delete/69963/useless Del: bad code -- https://master.php.net/note/delete/69963/bad+code Del: spam -- https://master.php.net/note/delete/69963/spam Del: non-english -- https://master.php.net/note/delete/69963/non-english Del: in docs -- https://master.php.net/note/delete/69963/in+docs Del: other reasons-- https://master.php.net/note/delete/69963 Reject -- https://master.php.net/note/reject/69963 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117762) next »