Peer authentication problem in CGI-Perl

Поиск
Список
Период
Сортировка
От arifin purba
Тема Peer authentication problem in CGI-Perl
Дата
Msg-id 20020213172912.14123.qmail@web20304.mail.yahoo.com
обсуждение исходный текст
Список pgsql-novice
I am writing a CGI-Perl script that connects to
PostgreSQL. For this I use the module Pg. I connect to
PostgreSQL using the command

Pg::connectdb("dbname=test user=johndoe
password=pass");

but everytime my connection is refused with the
message:

"Peer authentication failed for user 'johndoe'"

The same thing does NOT happen whenever I login from
shell-prompt with psql:

psql -U johndoe -W test /* no problem here */

Neither is it a problem to connect with Pg module in
non-CGI script ("normal" Perl script that runs on
shell).

Back to the CGI Script, if I try to connect without
user ID & password (only giving database name) the
error message is,

Peer authentication failed for user www-data.

Does this mean I have to create user www-data? Would
the same problem not happen again with user www-data?

Here's my Perl script, please help me:

#!/usr/bin/perl -w

use strict;
use Pg;
use CGI qw(:standard);

my $conn = Pg::connectdb("dbname=test user=johndoe
password=johndoe");

die $conn->errorMessage unless PGRES_CONNECTION_OK eq
    $conn->status;

print header, start_html;

my $result = $conn->exec("SELECT surname FROM people
WHERE id=10001");

die $conn->errorMessage unless PGRES_TUPLES_OK eq
    $result->resultStatus;

while(my @row = $result->fetchrow) {
    print @row, "\n";
}

print end_html;


Thanks beforehand
Arifin


____________________________________________________________
Do You Yahoo!?
Αποκτήστε τη δωρεάν @yahoo.gr διεύθυνση σας στο http://www.otenet.gr

В списке pgsql-novice по дате отправления:

Предыдущее
От: arifin purba
Дата:
Сообщение: Peer authentication problem in CGI-Perl
Следующее
От: "Patrick Hatcher"
Дата:
Сообщение: Re: Function Hangs