pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan T. Kim <kim@mpiz-koeln.mpg.de>
To: Pragati Sagar <pragatis@sapientinfotech.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Accessing the database
Date: Fri, 2 Jun 2000 17:19:04 +0200
Message-ID: <20000602171904.B2279@jupiter.mpiz-koeln.mpg.de> (raw)
In-Reply-To: <001e01bfcc82$76b8caa0$2ea093c0@sapientinfotech.com>
References: <001e01bfcc82$76b8caa0$2ea093c0@sapientinfotech.com>


On Fri, Jun 02, 2000 at 04:35:29PM +0530, Pragati Sagar wrote:
> Hi!
> I connecting the postgreSQL database through the following code:
> 
> <?
> $conn=pg_connect("<IP address>","<port>","","","<database>");
> $index=pg_exec($conn,"select * from table1");
> ?>
> 
> On execution of this code from the browser, following error appears :
> 
> Warning: PostgresSQL query failed: ERROR: table1: Permission denied. in
> /home/httpd/html/script.php3 on line 8
> 
> Where am I going wrong? Does the code have a problem or there is something
> wrong with the permissions.

A quick guess: Maybe you have not created a postgres user called "httpd" (or
"nobody", "daemon" etc., depending on your operating system). PHP scripts
run under the UID of the web server, which usually is not the same as
your personal account.

So, you can either create a httpd user in postgres, or alternatively, I
think that pg_connect() in PHP also offers a way to specify your username
and password as parameters (check out the PHP docs on the PostgreSQL
functions for details).

HTH.

Greetinx & have a nice weekend,
Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: kim@mpiz-koeln.mpg.de                           |
 |             WWW:   http://www.mpiz-koeln.mpg.de/~kim/              |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*



view thread (3+ messages)  latest in thread

Message-ID: <20000602171904.B2279@jupiter.mpiz-koeln.mpg.de>
Permalink:  ../20000602171904.B2279@jupiter.mpiz-koeln.mpg.de/
Also on:    postgresql.org/message-id/20000602171904.B2279@jupiter.mpiz-koeln.mpg.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: kim@mpiz-koeln.mpg.de, pragatis@sapientinfotech.com
  Subject: Re: Accessing the database
  In-Reply-To: <20000602171904.B2279@jupiter.mpiz-koeln.mpg.de>
  References: <001e01bfcc82$76b8caa0$2ea093c0@sapientinfotech.com> <20000602171904.B2279@jupiter.mpiz-koeln.mpg.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox