psql + php on Mac OS X

Поиск
Список
Период
Сортировка
Искать

psql + php on Mac OS X

От:
Martin Hampl <Martin.Hampl@gmx.de>
Дата:
Hi all,

I am trying to get PHP (with Apache) with PostgreSQL 7.4.1 running on 
Mac OS X 10.3.2..

I compiled PostgreSQL and PHP myself (PostgreSQL support in the newest 
PHP-package from entropy.ch seems to be broken---does anybody have 
experience with this? Everything worked perfectly a few months ago 
(with the package from entropy, If I remember correctly), but I had to 
reinstall the whole computer).

Both, PostgreSQL and PHP run just fine. However, if I try to access a 
database I just get the message "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?"

PostgreSQL is running and I think it is using port 5432 (however, I am 
not completely sure how to check this---"show port;"?)

Does anybody know the correct configuration for the compilation of PHP? 
I used './configure --with-mysql --with-pgsql --with-apxs. Maybe the 
path for pgsql is incorrect?

Regards,
Martin.

Re: psql + php on Mac OS X

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Martin Hampl  writes:
> Both, PostgreSQL and PHP run just fine. However, if I try to access a 
> database I just get the message "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?"

> PostgreSQL is running and I think it is using port 5432 (however, I am 
> not completely sure how to check this---"show port;"?)

My bet is that you have Postgres set to accept only Unix-socket
connections.  PHP is evidently trying to connect via a TCP socket.
I think it's possible to alter the PHP connection info to use a
Unix socket, but you might prefer to turn on tcpip_socket in Postgres.

			regards, tom lane

Re: psql + php on Mac OS X

От:
Martin Hampl <Martin.Hampl@gmx.de>
Дата:
It works, hooray! Thank you *very* much!

Regards,
Martin.

Am 08.03.2004 um 23:59 schrieb Tom Lane:

> Martin Hampl  writes:
>> Both, PostgreSQL and PHP run just fine. However, if I try to access a
>> database I just get the message "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?"
>
>> PostgreSQL is running and I think it is using port 5432 (however, I am
>> not completely sure how to check this---"show port;"?)
>
> My bet is that you have Postgres set to accept only Unix-socket
> connections.  PHP is evidently trying to connect via a TCP socket.
> I think it's possible to alter the PHP connection info to use a
> Unix socket, but you might prefer to turn on tcpip_socket in Postgres.
>
> 			regards, tom lane
>

Re: psql + php on Mac OS X

От:
Lola Lee <lola@his.com>
Дата:
At 5:59 PM -0500 3/8/04, Tom Lane wrote:
>I think it's possible to alter the PHP connection info to use a
>Unix socket, but you might prefer to turn on tcpip_socket in Postgres.


How would I do that?  Seems this is the same problem I've been having 
(the error messages reported are very similar to mine).

-- 

Lola - mailto:lola@his.com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
I'm in Bowie, MD, USA, halfway between DC and Annapolis.

Re: psql + php on Mac OS X

От:
Josh Berkus <josh@agliodbs.com>
Дата:
Lola,

> How would I do that?  Seems this is the same problem I've been having 
> (the error messages reported are very similar to mine).

1) Edit your PGDATA/postgresql.conf file.    Set the GUC variable 
tcpip_socket=true  (dont' forget to uncomment the line).
2) restart postgresql.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco

FAQ