Re: problems connecting to php via pg_connect and PGCLUSTER

From: Chris <dmagick(at)gmail(dot)com>
To: dave(dot)potts(at)pinan(dot)co(dot)uk
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problems connecting to php via pg_connect and PGCLUSTER
Date: 2012-02-07 22:35:44
Message-ID: 4F31A740.9060405@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/02/12 17:08, Dave Potts wrote:
> 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

psql knows what 'PGCLUSTER' is.

pg_connect() doesn't (unrecognised parameter "cluster"), so you can't do
it that way.

You could try

define('PG_OPTIONS', 'PGCLUSTER=9.1/main');

If that doesn't work you'll have to do it the other way I mentioned.

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-02-07 22:43:26 Re: problems connecting to php via pg_connect and PGCLUSTER
Previous Message Andrew Dunstan 2012-02-07 22:00:13 Re: [GENERAL] pg_dump -s dumps data?!