Re: Problems with Postgres and PHP from command line - Mailing list pgsql-general

From mike g
Subject Re: Problems with Postgres and PHP from command line
Date
Msg-id 1088653863.20010.23.camel@localhost.localdomain
Whole thread Raw
In response to Problems with Postgres and PHP from command line  (Kristopher Spencer-Yates <kris@2binteractive.com>)
List pgsql-general
Sounds like a permissions problem with cron.  Was the cron job created
under the non-root users account?

On Thu, 2004-06-24 at 15:47, Kristopher Spencer-Yates wrote:
> Hi
>
> I have a PHP script running as a non-root user.  The non-root user will
> exec PHP script via cron once per day.
>
> Warning: pg_exec(): Query failed: ERROR:  checkout: Permission denied.
> . in /usr/home/nonrootuser/script.php on line 23
>
> Line 23 is, of course, the $result = pg_exec($db_connect, $call);
>
> My DB connect is to a postgres server (same physical box as where script
> is running).
>
> $db_connect=pg_connect("user=nonrootuser dbname=thedatabase");
>
> note: PHP website can connect with no problems to this local postgres
> db; apache runs as nobody, connecting via a PHP db_connect as
> "user=someotheruser dbname=thedatabase".
>
> "thedatabase" looks like:
> checkout | table | someotheruser
>
> So I did a grant all priviliges for "nonrootuser" and "nobody" on all
> tables in "thedatabase".  I do a \z on a table and see my grant.. but it
> isnt working.  Not sure what else to provide at this time to help anyone
> willing to help me.. Just ask and I'll be able to provide any info on
> request.
>
> So.. my question:  How do we get unix command line user "nonrootuser" to
> run a script as "nonrootuser" and access "thedatabase"?  I searched the
> docs already and so now I am here begging for help :)
>
> Thanks,
>
> Kris

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Dump / restore for optimization?
Next
From: Tom Lane
Date:
Subject: Re: Problems restarting after database crashed (signal 11).