X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D7B6F11F6D42 for ; Tue, 4 Apr 2006 10:54:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40276-06 for ; Tue, 4 Apr 2006 10:54:01 -0300 (ADT) X-Greylist: delayed 00:06:38.6847 by SQLgrey- Received: from rediffmail.com (unknown [203.199.83.42]) by postgresql.org (Postfix) with SMTP id 740BA11F662B for ; Tue, 4 Apr 2006 10:53:56 -0300 (ADT) Received: (qmail 22094 invoked by uid 510); 4 Apr 2006 13:46:32 -0000 Date: 4 Apr 2006 13:46:32 -0000 Message-ID: <20060404134632.22093.qmail@webmail55.rediffmail.com> Received: from unknown (203.200.43.195) by rediffmail.com via HTTP; 04 apr 2006 13:46:32 -0000 MIME-Version: 1.0 From: "muralidhar sortur" Reply-To: "muralidhar sortur" To: "Javier Carlos" , "Gnanavel S" , "pgsql_php" Subject: Re: Unable to connect to PostgreSQL Server: Permission denied Content-type: multipart/alternative; boundary="Next_1144158392---0-203.199.83.42-22090" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.365 required=5 tests=[AWL=0.459, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0, RCVD_IN_NJABL_SPAM=1.905] X-Spam-Score: 2.365 X-Spam-Level: ** X-Archive-Number: 200604/4 X-Sequence-Number: 3474 This is a multipart mime message --Next_1144158392---0-203.199.83.42-22090 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =0AHi ,=0Ain my last mail i forgot to mention that i have restarted apach= e server after making changes to the httpd.conf.=0A=0AToday i made one more= experiment ...=0A=0A1. changed httpd.conf =0A=0A user apache=0A Grou= p apache=0A=0A DocumentRoot=3D"/home/murali/html"=0A=0A =0A ......(as it is)....=0A =0A=0A= 2. copied the files add.html and add-entry.html to directory html under my = home directory i.e =0A=0A/home/murali/html=0A=0A3. restarted apache=0A/usr/= sbin/apachectl start ( from root)=0A=0A4. from postgres login started postm= aster.=0A=0Apostmaster -i -D data&=0A=0A5. http://localhost/add.html ( ente= red Name , Phone , Email)=0A =0AEVERY THING WORKED !!!!!=0A=0ABUT CAN ANY= ONE TELL ME, WHAT WAS THE PROBLEM WITH EARLIER SETTING AND WHAT MADE IT TO= WORK PROPERLY NOW !!! I NEED TO ANSWER THESE QUESTIONS=0A=0A=0AThanks for = all of your help =0Aregards=0AMuralidhar=0A=0AOn Tue, 04 Apr 2006 Javier Ca= rlos wrote :=0A> Did you try to restart the PosgreSQL server using pg_ctl= ?=0A>=0A>$ pg_ctl restart=0A>=0A>=0A> Are you able to connect as user f= rom the command line?=0A>=0A>$ psql AddressBook www=0A>=0A> Regards,=0A>= =0A> Javier=0A>=0A>=0A> >=0A> > Hi ,=0A> > Here is the complete descripti= on of the problem ...=0A> >=0A> > I have newly installed fedora core 4 with= option as everyting.=0A> >=0A> > it comes with apache webserver, postgresq= l , php-postgresql, php-gd etc,=0A> >=0A> > it creates a default user postg= res with home =3D /var/lib/psql=0A> >=0A> > 1. i loged in as postgres=0A> >= =0A> > 2. called initdb=0A> > created database under directory ~/data=0A>= >=0A> > 3. changed postgresql.conf to include=0A> > listen_addresses= =3D '*'=0A> > port =3D 5432=0A> >=0A> > 4. changed pg_hba.conf=0A> >= local all all trust=0A> > host all= all 127.0.0.1/32 trust=0A> > host all all 192.168.1.18= /24 trust=0A> > host all all ::1/128 trust=0A>= >=0A> > 5. postmaster -i -D ~/data &=0A> >=0A> > 6. createdb AddressBook= =0A> >=0A> > 7. psql AddressBook=0A> >=0A> > 8. create table addresses( Nam= e text, Phone text, Email text);=0A> >=0A> > 9. create user www NOCREATEDB = NOCREATEUSER;=0A> >=0A> > 10. grant all on addresses to www;=0A> >=0A> > 11= . from other terminal i loged in as root=0A> >=0A> > 12. changed /etc/httpd= /conf/httpd.conf=0A> >=0A> > User www=0A> > Group postgres=0A> >=0A= > > 13. copied add.html and add-entry.php into directory /var/www/html=0A> = >=0A> > add.html=0A> > ----------------------------------------------------= --=0A> > =0A> > =0A> >=0A> >
=0A> >=0A> > =0A> > =0A> > =0A= > > =0A> >
=0A> >= =0A> > =0A> > = =0A> > =0A> > =0A> > =0A> > =0A> > = =0A> > =0A= > > =0A> > =0A> > =0A> > =0A> > =0A> > =0A> > =0A> > =0A> > =0A> >
Name
Phone
E-mail
=0A> >
=0A> >
=0A> >=0A> > =0A> > = =0A> > --------------------------------------------------=0A> > add-entry.p= hp=0A> > --------------------------------------------------=0A> >=0A> > =0A> > =0A> > > $db =3D pg_Connect( "dbname=3DAddressBoo= k user=3Dwww");=0A> > if( !$db )=0A> > {=0A> > echo "Could not connect!";= =0A> > exit;=0A> > }=0A> >=0A> > $Name=3D$_GET['Name'];=0A> > $Email=3D$_= GET['Email'];=0A> > $Phone=3D$_GET['Phone'];=0A> >=0A> > $query =3D "INSERT= INTO Addresses VALUES( '$Name', '$Phone', '$Email' );";=0A> >=0A> > $resul= t =3D pg_Exec( $db, $query );=0A> >=0A> > if( !$result )=0A> > {=0A> > ec= ho "No result set returned!";=0A> > exit;=0A> > }=0A> >=0A> > $rows =3D p= g_NumRows( $result );=0A> >=0A> > if( $rows =3D 0 )=0A> > {=0A> > echo "A= dd Failed.";=0A> > exit;=0A> > }=0A> >=0A> > $query =3D "SELECT * FROM Ad= dresses WHERE \"Name\" =3D '$Name';";=0A> >=0A> > $query =3D "SELECT * FROM= Addresses WHERE \"Name\" =3D '$Name';";=0A> >=0A> > $result =3D pg_Exec( $= db, $query );=0A> > $row =3D pg_Fetch_Row( $result, 0 );=0A> >=0A> > $nameR= esult =3D $row[0];=0A> > $phoneResult =3D $row[1];=0A> > $emailResult =3D $= row[2];=0A> >=0A> > echo "Name =3D $nameResult
";=0A> > echo "Phone =3D = $phoneResult
";=0A> > echo "E-mail =3D $emailResult
";=0A> >=0A> > pg= _Close( $db );=0A> > ?>=0A> >=0A> >

Add Okay!

=0A> >=0A> > = =0A> > =0A> > ------------------------------------------------------= -------=0A> > Error i get is=0A> > Mon Apr 03 18:39:53 2006] [notice] Apach= e/2.0.54 (Fedora) configured --=0A> > resuming normal operations=0A> > [Mon= Apr 03 18:42:17 2006] [error] [client 127.0.0.1] File does not exist:=0A> = > /var/www/html/favicon.ico=0A> > [client 127.0.0.1] PHP Warning: pg_conne= ct() [ > href=3D'function.pg-connect'>function.pg-connect]: Unabl= e to connect to=0A> > PostgreSQL server: could not connect to server: Permi= ssion denied\n\tIs=0A> > the server running locally and accepting\n\tconnec= tions on Unix domain=0A> > socket "/tmp/.s.PGSQL.5432"? in /var/www/html/ad= d-entry.php on=0A> > line 5, referer: http://localhost/add.html=0A> > [Mon = Apr 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exist:=0A> >= /var/www/html/favicon.ico=0A> >=0A> > ____________________________________= ___________________=0A> >=0A> > from the command line it works fine=0A> > i= .e php add-entry.php works fine ( ofcourse adds an empty row into the=0A> >= data base)=0A> >=0A> > --------------------------------------------------= =0A> >=0A> > i did telnet=0A> >=0A> > [root@localhost html]# telnet localho= st 5432=0A> > Trying 127.0.0.1...=0A> > Connected to localhost.localdomain = (127.0.0.1).=0A> > Escape character is '^]'.=0A> >=0A> >=0A> > Connection c= losed by foreign host.=0A> >=0A> > data/pg_log/postgresql-Mon.log contains= =0A> >=0A> > LOG: invalid length of startup packet=0A> >=0A> >=0A> >=0A> >= -------------------------------=0A> >=0A> >=0A> > I am not getting any clu= e as to how to solve this problem ...let me know=0A> > if you have any idea= in solving this porblem.=0A> >=0A> > regards=0A> > Muralidhar=0A> >=0A> >= =0A> >=0A>=0A>=0A>=0A>-------------=0A>nediam.com.mx=0A>=0A>=0A>-----------= ----------------(end of broadcast)---------------------------=0A>TIP 5: don= 't forget to increase your free space map settings=0A --Next_1144158392---0-203.199.83.42-22090 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A 
=0AHi ,
=0Ain my last mail i forgot to mention that i h= ave restarted apache server after making changes to the httpd.conf.
=0A<= BR>=0AToday i made one more experiment ...
=0A
=0A1. changed httpd.co= nf
=0A
=0A    user apache
=0A    Group apache=
=0A
=0A    DocumentRoot=3D"/home/murali/html"=0A
=0A    <DocumentRoot "/home/murali/html">=
=0A    ......(as it is)....
=0A    <DocumentR= oot>
=0A
=0A2. copied the files add.html and add-entry.html to dir= ectory html under my home directory i.e
=0A
=0A/home/murali/html
= =0A
=0A3. restarted apache
=0A/usr/sbin/apachectl start ( from root)<= BR>=0A
=0A4. from postgres login started postmaster.
=0A
=0Apostma= ster -i -D data&
=0A
=0A5. http://localhost/add.html ( entered Na= me , Phone , Email)
=0A 
=0AEVERY THING WORKED !!!!!
=0A=0ABUT CAN ANY ONE TELL ME, WHAT WAS THE PROBLEM WITH EARLIER SETTING AND = WHAT MADE IT TO WORK PROPERLY NOW !!! I NEED TO ANSWER THESE QUESTIONS
= =0A
=0A
=0AThanks for all of your help
=0Aregards
=0AMuralidha= r
=0A
=0AOn Tue, 04 Apr 2006 Javier Carlos wrote :
=0A>  = Did you try to restart the PosgreSQL server using pg_ctl ?
=0A>
= =0A>$ pg_ctl restart
=0A>
=0A>
=0A>    Are y= ou able to connect as user from the command line?
=0A>
=0A>$ ps= ql AddressBook www
=0A>
=0A>  Regards,
=0A>
=0A&= gt;  Javier
=0A>
=0A>
=0A> >
=0A> > Hi = ,
=0A> > Here is the complete description of the problem ...
= =0A> >
=0A> > I have newly installed fedora core 4 with opti= on as everyting.
=0A> >
=0A> > it comes with apache webse= rver, postgresql , php-postgresql, php-gd etc,
=0A> >
=0A> &= gt; it creates a default user postgres with home =3D /var/lib/psql
=0A&g= t; >
=0A> > 1. i loged in as postgres
=0A> >
=0A>= ; > 2. called initdb
=0A> >  created database under direc= tory ~/data
=0A> >
=0A> > 3. changed postgresql.conf to i= nclude
=0A> >      listen_addresses =3D '*'
=0A= > >      port =3D 5432
=0A> >
=0A> >= ; 4. changed pg_hba.conf
=0A> >      local  a= ll  all                  =       trust
=0A> >      host  =   all  all  127.0.0.1/32        trust=0A> >      host    all  all  19= 2.168.1.18/24      trust
=0A> >     = host    all  all        ::1/128  =       trust
=0A> >
=0A> > 5. postmaster -i= -D ~/data &
=0A> >
=0A> > 6. createdb AddressBook=0A> >
=0A> > 7. psql AddressBook
=0A> >
=0A>= ; > 8. create table addresses( Name text, Phone text, Email text);
= =0A> >
=0A> > 9. create user www NOCREATEDB NOCREATEUSER;=0A> >
=0A> > 10. grant all on addresses to www;
=0A>= >
=0A> > 11. from other terminal i loged in as root
=0A>= >
=0A> > 12. changed /etc/httpd/conf/httpd.conf
=0A> >= ;
=0A> >    User www
=0A> >    Grou= p postgres
=0A> >
=0A> > 13. copied add.html and add-entr= y.php into directory /var/www/html
=0A> >
=0A> > add.html=
=0A> > ------------------------------------------------------
= =0A> > <HTML>
=0A> > <BODY>
=0A> >
= =0A> > <FORM ACTION=3D"add-entry.php" METHOD=3D"GET= ">
=0A> >
=0A> > <TABLE BORDER=3D1>
=0A&= gt; >  <TR>
=0A> >  <TD>
=0A> >= ;  <TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2>
=0A>= ; >    <TR>
=0A> >    <TD>Nam= e</TD>
=0A> >    <TD><INPUT TYPE=3D"= ;TEXT" NAME=3D"Name" VALUE=3D""></TD>
= =0A> >    </TR>
=0A> >    <TR= >
=0A> >    <TD>Phone</TD>
=0A> &g= t;    <TD><INPUT TYPE=3D"TEXT" NAME=3D"P= hone" VALUE=3D""></TD>
=0A> >   = </TR>
=0A> >    <TR>
=0A> > = ;   <TD>E-mail</TD>
=0A> >    <TD&= gt;<INPUT TYPE=3D"TEXT" NAME=3D"Email" VALUE=3D"= ;"></TD>
=0A> >    </TR>
=0A>= >    <TR>
=0A> >    <TD COLSPAN= =3D2 ALIGN=3DCENTER>
=0A> >      <INPUT TYPE= =3D"SUBMIT" VALUE=3D"Add Entry">
=0A> >&nbs= p;   </TD>
=0A> >    </TR>
=0A>= >  </TABLE>
=0A> >  </TD>
=0A> &= gt;  </TR>
=0A> > </TABLE>
=0A> > </= FORM>
=0A> >
=0A> > </BODY>
=0A> > <= /HTML>
=0A> > -------------------------------------------------= -
=0A> > add-entry.php
=0A> > ---------------------------= -----------------------
=0A> >
=0A> > <HTML>
=0A= > > <BODY>
=0A> > <?PHP
=0A> > $db =3D pg_= Connect( "dbname=3DAddressBook user=3Dwww");
=0A> > if( = !$db )
=0A> > {
=0A> >  echo "Could not connec= t!";
=0A> >  exit;
=0A> > }
=0A> >=0A> > $Name=3D$_GET['Name'];
=0A> > $Email=3D$_GET['Email'= ];
=0A> > $Phone=3D$_GET['Phone'];
=0A> >
=0A> >= $query =3D "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email'= );";
=0A> >
=0A> > $result =3D pg_Exec( $db, $query= );
=0A> >
=0A> > if( !$result )
=0A> > {
=0A= > >  echo "No result set returned!";
=0A> >&= nbsp; exit;
=0A> > }
=0A> >
=0A> > $rows =3D pg= _NumRows( $result );
=0A> >
=0A> > if( $rows =3D 0 )
= =0A> > {
=0A> >  echo "Add Failed.";
=0A&= gt; >  exit;
=0A> > }
=0A> >
=0A> > $qu= ery =3D "SELECT * FROM Addresses WHERE \"Name\" =3D '$Name';= ";
=0A> >
=0A> > $query =3D "SELECT * FROM Addr= esses WHERE \"Name\" =3D '$Name';";
=0A> >
=0A&g= t; > $result =3D pg_Exec( $db, $query );
=0A> > $row =3D pg_Fet= ch_Row( $result, 0 );
=0A> >
=0A> > $nameResult =3D $row[= 0];
=0A> > $phoneResult =3D $row[1];
=0A> > $emailResult = =3D $row[2];
=0A> >
=0A> > echo "Name =3D $nameResul= t<BR>";
=0A> > echo "Phone =3D $phoneResult<BR&= gt;";
=0A> > echo "E-mail =3D $emailResult<BR>&quo= t;;
=0A> >
=0A> > pg_Close( $db );
=0A> > ?><= BR>=0A> >
=0A> > <H3>Add Okay!</H3>
=0A> &= gt;
=0A> > </BODY>
=0A> > </HTML>
=0A> = > -------------------------------------------------------------
=0A&g= t; > Error i get is
=0A> > Mon Apr 03 18:39:53 2006] [notice] A= pache/2.0.54 (Fedora) configured --
=0A> > resuming normal operati= ons
=0A> > [Mon Apr 03 18:42:17 2006] [error] [client 127.0.0.1] F= ile does not exist:
=0A> > /var/www/html/favicon.ico
=0A> &g= t; [client 127.0.0.1] PHP Warning:  pg_connect() [<a
=0A> >= ; href=3D'function.pg-connect'>function.pg-connect</a>]: Unable to= connect to
=0A> > PostgreSQL server: could not connect to server:= Permission denied\n\tIs
=0A> > the server running locally and acc= epting\n\tconnections on Unix domain
=0A> > socket "/tmp/.s.P= GSQL.5432"? in /var/www/html/add-entry.php on
=0A> > line 5, = referer: http://localhost/add.html
=0A> > [Mon Apr 03 18:42:22 200= 6] [error] [client 127.0.0.1] File does not exist:
=0A> > /var/www= /html/favicon.ico
=0A> >
=0A> > _________________________= ______________________________
=0A> >
=0A> > from the com= mand line it works fine
=0A> > i.e php add-entry.php works fine ( = ofcourse adds an empty row into the
=0A> > data base)
=0A> &= gt;
=0A> > --------------------------------------------------
= =0A> >
=0A> > i did telnet
=0A> >
=0A> > [= root@localhost html]# telnet localhost 5432
=0A> > Trying 127.0.0.= 1...
=0A> > Connected to localhost.localdomain (127.0.0.1).
=0A= > > Escape character is '^]'.
=0A> >
=0A> >
=0A&= gt; > Connection closed by foreign host.
=0A> >
=0A> >= data/pg_log/postgresql-Mon.log contains
=0A> >
=0A> > LO= G:  invalid length of startup packet
=0A> >
=0A> >=0A> >
=0A> > -------------------------------
=0A> &= gt;
=0A> >
=0A> > I am not getting any clue as to how to = solve this problem ...let me know
=0A> > if you have any idea in s= olving this porblem.
=0A> >
=0A> > regards
=0A> >= ; Muralidhar
=0A> >
=0A> >
=0A> >
=0A>
= =0A>
=0A>
=0A>-------------
=0A>nediam.com.mx
=0A&g= t;
=0A>
=0A>---------------------------(end of broadcast)------= ---------------------
=0A>TIP 5: don't forget to increase your free s= pace map settings
=0A=0A

=0A

=0A=0A --Next_1144158392---0-203.199.83.42-22090--