note 33195 added to ref.pgsql
| From: | xp3g at hotmail dot com | Date: | Wed, 18 Jun 2003 19:37:29 +0000 |
| Subject: | note 33195 added to ref.pgsql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50600@lists.php.net to get a copy of this message | ||
Debian hint:
In debian, Apache/PHP runs as www-data, so to access postgreSQL databases and tables:
1. You need to add www-data as PostgreSQL user and use quotes around "www-data":
$ su
# su - postgres
$ createuser "www-data"
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
$exit
#exit
$
2. Since you're not logging on as "www-data", creating databases and tables, you need
to grant access to tables you create to www-data:
$ psql mydb
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
mydb=> grant all on <tablename> to "www-data";
GRANT
----
Manual Page -- http://www.php.net/manual/en/ref.pgsql.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33195
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33195&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33195&report=yes