Re: Problems with Postgres and PHP from command line

From: mike g <mike(at)thegodshalls(dot)com>
To: kris(at)2binteractive(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems with Postgres and PHP from command line
Date: 2004-07-01 03:51:03
Message-ID: 1088653863.20010.23.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2004-07-01 04:15:42 Re: Internationalization
Previous Message Tom Lane 2004-07-01 03:50:24 Re: Problems restarting after database crashed (signal 11).