Re: Unable to connect to PostgreSQL server via PHP
От
Lim Berger
Тема
Re: Unable to connect to PostgreSQL server via PHP
Дата
Msg-id
69d2538f0708130351h6164d08axa51641f1e0645dad@mail.gmail.com
Ответ на
Re: Unable to connect to PostgreSQL server via PHP (John Coulthard)
Список
Дерево обсуждения
Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
Re: Unable to connect to PostgreSQL server via PHP Julio Cesar Sánchez González<knowhow@sistemasyconectividad.com.mx>
Re: Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
Re: Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
Re: Unable to connect to PostgreSQL server via PHP "Lim Berger" <straightfwd007@gmail.com>
Re: Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
Re: Unable to connect to PostgreSQL server via PHP Tom Lane <tgl@sss.pgh.pa.us>
Re: Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
Re: Unable to connect to PostgreSQL server via PHP "John Coulthard" <bahhab@hotmail.com>
On 8/13/07, John Coulthard wrote:
> The part of the php code for the connection is
>
>
> $dbconn=pg_connect( "dbname=lumbribase host=localhost port=5432
> user=postgres password=$PG_PASS" );
> if ( ! $dbconn ) {
> echo "Error connecting to the database !
" ;
> printf("%s", pg_errormessage( $dbconn ) );
> exit(); }
>
> This code works on zeldia
> http://zeldia.cap.ed.ac.uk/Lumbribase/search_id.php
> but not on xyala http://xyala.cap.ed.ac.uk/Lumbribase/search_id.php
>
> So it's something to do with the way xyala is set up. I'm sure I'm missing
> something obvious but what..?
>
> It's not a firewall issue because it persists when the iptabes are off.
>
> What does "could not connect to server: Permission denied" mean? Have I
> done some something as root or me that I should have done as
> user postgres?
Hi John,
Had the same issue. Try the following steps:
1. PGHBA.CONF
This is an important file. Mine (on Linux CentOS 4) is located at
"/var/lib/pgsql/data/pghba.conf". Make sure it looks like the
following.
local all all md5
host all all 127.0.0.1 255.255.255.255 md5
2. POSTGRESQL.CONF
listen_addresses = 'localhost,*'
#port = 5432
....other settings....
3. PHP CODE
link = pg_connect("host=localhost dbname=MYDB user=MYUSER password=MYPASS");
--
That is all you need. Don't specify anything else in the connection
string. Let me know how it goes.
LB
В списке pgsql-general по дате отправления