Re: problems connecting to php via pg_connect and PGCLUSTER

Поиск
Список
Период
Сортировка
От Dave Potts
Тема Re: problems connecting to php via pg_connect and PGCLUSTER
Дата
Msg-id 7640f527eff169824e257b0cfde266dc.squirrel@dp2642.force9.co.uk
обсуждение исходный текст
Ответ на Re: problems connecting to php via pg_connect and PGCLUSTER  (Chris <dmagick@gmail.com>)
Ответы Re: problems connecting to php via pg_connect and PGCLUSTER  (Chris <dmagick@gmail.com>)
Список pgsql-general
Hi Chris
Thanks for the suggestion,  I tried a making the changes are you suggest,
I still getting an error from Postgres ie
 define("PG_OPTIONS"  , "--cluster=9.1/main");
 define("PG_DB"  , "tripe");
 define("PG_HOST", "localhost");
 define("PG_USER", "dp42");
 define("PG_PORT", "5432");
 define("TABLE",   "route_table");
$con = pg_connect("dbname='".PG_DB."' host='".PG_HOST."'
user='".PG_USER."' options='".PG_OPTIONS."'");

Error message
04:41 2012] [error] [client 127.0.0.1] PHP Warning:  pg_connect(): Unable
to connect to PostgreSQL server: FATAL:  unrecognised configuration
parameter "cluster" in /var/www/re/php/pgrouting.php on line 34, referer:
http://127.0.0.1/re/routing-final.html

The problem is with the database server it has issues with the string
--cluster=9.1/main"

The system is happy enough if I set PGCLUSTER as follows

export PGCLUSTER=9.1/main
psql -d tripe

I am justing trying to the same with pg_connect


 wrote:
> On 07/02/12 10:03, Dave Potts wrote:
>>
>> I have two versions of postgres installed, 8.4 and 9.1 installed on the
>> same machine
>>
>> To connect to my 9.1 database, I defined the envromental variable
>>
>> PGCLUSTER=9.1/main
>>
>> and use psql to connect via php pg_connect
>> I have try saying
>>
>> define("PG_OPTIONS"  , "--cluster=9.1/main");
>>
>> and using the phrase
>>
>>    $con = pg_connect("dbname=".PG_DB." host=".PG_HOST." user=".PG_USER."
>> options=".PG_OPTIONS);
>>
>> When I attempt to connect to postgres,  I get the  error
>>
>> [Mon Feb 06 22:37:40 2012] [error] [client 127.0.0.1] PHP Warning:
>> pg_connect(): Unable to connect to PostgreSQL server: FATAL:
>> unrecognised
>> configuration parameter "cluster" in /var/www/re/php/pgrouting.php on
>> line
>> 33, referer: http://127.0.0.1/re/routing-final.html
>>
>> Any suggestions as to the correct way of connecting to postgres?
>
> Try putting quotes around the options, eg:
> pg_connect("host=localhost options='".PG_OPTIONS."'");
>
> Alternatively, set the port and the path to the socket directory (not
> the actual file), eg:
>
> pg_connect('dbname=xxx host=/tmp user=xxx port=5433');
>
> If the socket file is in /tmp/
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


--



В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Travers
Дата:
Сообщение: Re: Don't Thread On Me (PostgreSQL related)
Следующее
От: "Dave Potts"
Дата:
Сообщение: default database selector