Re: Unable to connect to PostgreSQL Server: Permission denied

Поиск
Список
Период
Сортировка
Искать
От
Javier Carlos
Тема
Re: Unable to connect to PostgreSQL Server: Permission denied
Дата
Msg-id
65133.201.139.153.195.1144127587.squirrel@mail.nediam.com.mx
Ответ на
Список
Дерево обсуждения
Re: Unable to connect to PostgreSQL Server: Permission denied "muralidhar sortur" <sorturmuralidhar@rediffmail.com>
Re: Unable to connect to PostgreSQL Server: Permission denied CGMoller@StateStreet.com
  Did you try to restart the PosgreSQL server using pg_ctl ?

$ pg_ctl restart


   Are you able to connect as user from the command line?

$ psql AddressBook www

  Regards,

  Javier


>
> Hi ,
> Here is the complete description of the problem ...
>
> I have newly installed fedora core 4 with option as everyting.
>
> it comes with apache webserver, postgresql , php-postgresql, php-gd etc,
>
> it creates a default user postgres with home = /var/lib/psql
>
> 1. i loged in as postgres
>
> 2. called initdb
>   created database under directory ~/data
>
> 3. changed postgresql.conf to include
>       listen_addresses = '*'
>       port = 5432
>
> 4. changed pg_hba.conf
>       local  all  all                        trust
>       host    all  all  127.0.0.1/32        trust
>       host    all  all  192.168.1.18/24      trust
>       host    all  all        ::1/128        trust
>
> 5. postmaster -i -D ~/data &
>
> 6. createdb AddressBook
>
> 7. psql AddressBook
>
> 8. create table addresses( Name text, Phone text, Email text);
>
> 9. create user www NOCREATEDB NOCREATEUSER;
>
> 10. grant all on addresses to www;
>
> 11. from other terminal i loged in as root
>
> 12. changed /etc/httpd/conf/httpd.conf
>
>     User www
>     Group postgres
>
> 13. copied add.html and add-entry.php into directory /var/www/html
>
> add.html
> ------------------------------------------------------
> 
> 
>
> 
>
> 
>   
>   
>   
> 
> > > > > > > > > > > > > > > > >
Name
Phone
E-mail
> >
>
> > > > > -------------------------------------------------- > add-entry.php > -------------------------------------------------- > > > > $db = pg_Connect( "dbname=AddressBook user=www"); > if( !$db ) > { > echo "Could not connect!"; > exit; > } > > $Name=$_GET['Name']; > $Email=$_GET['Email']; > $Phone=$_GET['Phone']; > > $query = "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email' );"; > > $result = pg_Exec( $db, $query ); > > if( !$result ) > { > echo "No result set returned!"; > exit; > } > > $rows = pg_NumRows( $result ); > > if( $rows = 0 ) > { > echo "Add Failed."; > exit; > } > > $query = "SELECT * FROM Addresses WHERE \"Name\" = '$Name';"; > > $query = "SELECT * FROM Addresses WHERE \"Name\" = '$Name';"; > > $result = pg_Exec( $db, $query ); > $row = pg_Fetch_Row( $result, 0 ); > > $nameResult = $row[0]; > $phoneResult = $row[1]; > $emailResult = $row[2]; > > echo "Name = $nameResult
"; > echo "Phone = $phoneResult
"; > echo "E-mail = $emailResult
"; > > pg_Close( $db ); > ?> > >

Add Okay!

> > > > ------------------------------------------------------------- > Error i get is > Mon Apr 03 18:39:53 2006] [notice] Apache/2.0.54 (Fedora) configured -- > resuming normal operations > [Mon Apr 03 18:42:17 2006] [error] [client 127.0.0.1] File does not exist: > /var/www/html/favicon.ico > [client 127.0.0.1] PHP Warning: pg_connect() [ href='function.pg-connect'>function.pg-connect]: Unable to connect to > PostgreSQL server: could not connect to server: Permission denied\n\tIs > the server running locally and accepting\n\tconnections on Unix domain > socket "/tmp/.s.PGSQL.5432"? in /var/www/html/add-entry.php on > line 5, referer: http://localhost/add.html > [Mon Apr 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exist: > /var/www/html/favicon.ico > > _______________________________________________________ > > from the command line it works fine > i.e php add-entry.php works fine ( ofcourse adds an empty row into the > data base) > > -------------------------------------------------- > > i did telnet > > [root@localhost html]# telnet localhost 5432 > Trying 127.0.0.1... > Connected to localhost.localdomain (127.0.0.1). > Escape character is '^]'. > > > Connection closed by foreign host. > > data/pg_log/postgresql-Mon.log contains > > LOG: invalid length of startup packet > > > > ------------------------------- > > > I am not getting any clue as to how to solve this problem ...let me know > if you have any idea in solving this porblem. > > regards > Muralidhar > > > ------------- nediam.com.mx
В списке pgsql-php по дате отправления
От: Mariusz Pękala
Дата:
От: muralidhar sortur
Дата:
FAQ