Received: from jupiter.mpiz-koeln.mpg.de (jupiter.mpiz-koeln.mpg.de [193.174.239.39]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA43098 for ; Fri, 2 Jun 2000 11:19:57 -0400 (EDT) (envelope-from kim@jupiter.mpiz-koeln.mpg.de) Received: (from kim@localhost) by jupiter.mpiz-koeln.mpg.de (8.9.3/8.9.3) id RAA03342; Fri, 2 Jun 2000 17:19:04 +0200 (MET DST) Date: Fri, 2 Jun 2000 17:19:04 +0200 From: "Jan T. Kim" To: Pragati Sagar Cc: pgsql-admin@postgresql.org Subject: Re: Accessing the database Message-ID: <20000602171904.B2279@jupiter.mpiz-koeln.mpg.de> Mail-Followup-To: Pragati Sagar , pgsql-admin@postgresql.org References: <001e01bfcc82$76b8caa0$2ea093c0@sapientinfotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <001e01bfcc82$76b8caa0$2ea093c0@sapientinfotech.com>; from pragatis@sapientinfotech.com on Fri, Jun 02, 2000 at 04:35:29PM +0530 X-Archive-Number: 200006/28 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("","","","",""); > $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 >=-----*