
Unable to connect to PostgreSQL Server: Permission denied
This is a multipart mime message
--Next_1144083971---0-203.199.83.33-19612
Content-type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
=0AHi ,=0AHere is the complete description of the problem ...=0A=0AI have=
newly installed fedora core 4 with option as everyting.=0A=0Ait comes with=
apache webserver, postgresql , php-postgresql, php-gd etc,=0A=0Ait creates=
a default user postgres with home =3D /var/lib/psql=0A=0A1. i loged in as =
postgres=0A=0A2. called initdb=0A created database under directory ~/data=
=0A=0A3. changed postgresql.conf to include=0A listen_addresses =3D '*=
'=0A port =3D 5432=0A=0A4. 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=0A5. postmaster -i -D ~/data &=0A=
=0A6. createdb AddressBook=0A=0A7. psql AddressBook=0A=0A8. create table ad=
dresses( Name text, Phone text, Email text);=0A=0A9. create user www NOCREA=
TEDB NOCREATEUSER;=0A=0A10. grant all on addresses to www;=0A=0A11. from ot=
her terminal i loged in as root=0A=0A12. changed /etc/httpd/conf/httpd.conf=
=0A=0A User www=0A Group postgres=0A=0A13. copied add.html and add-en=
try.php into directory /var/www/html=0A=0Aadd.html=0A----------------------=
--------------------------------=0A<HTML>=0A<BODY>=0A=0A<FORM ACTION=3D"add=
-entry.php" METHOD=3D"GET">=0A=0A<TABLE BORDER=3D1>=0A <TR>=0A <TD>=0A <=
TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2>=0A <TR>=0A <TD>Name=
</TD>=0A <TD><INPUT TYPE=3D"TEXT" NAME=3D"Name" VALUE=3D""></TD>=0A <=
/TR>=0A <TR>=0A <TD>Phone</TD>=0A <TD><INPUT TYPE=3D"TEXT" NAME=3D=
"Phone" VALUE=3D""></TD>=0A </TR>=0A <TR>=0A <TD>E-mail</TD>=0A =
<TD><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 </TD>=0A </TR>=0A </TABLE>=0A </TD>=0A </T=
R>=0A</TABLE>=0A</FORM>=0A=0A</BODY>=0A</HTML>=0A--------------------------=
------------------------=0Aadd-entry.php=0A----------------- ---------------=
------------------=0A=0A<HTML>=0A<BODY>=0A<?PHP=0A$db =3D pg_Connect( "dbna=
me=3DAddressBook user=3Dwww");=0Aif( !$db )=0A{=0A echo "Could not connect=
!";=0A exit;=0A}=0A=0A$Name=3D$_GET['Name'];=0A$Email=3D$_GET['Emai l'];=0A=
$Phone=3D$_GET['Phone'];=0A=0A$query =3D "INSERT INTO Addresses VALUES( '$N=
ame', '$Phone', '$Email' );";=0A=0A$result =3D pg_Exec( $db, $query );=0A=
=0Aif( !$result )=0A{=0A echo "No result set returned!";=0A exit;=0A}=0A=
=0A$rows =3D pg_NumRows( $result );=0A=0Aif( $rows =3D 0 )=0A{=0A echo "Ad=
d Failed.";=0A exit;=0A}=0A=0A$query =3D "SELECT * FROM Addresses 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_Fe=
tch_Row( $result, 0 );=0A=0A$nameResult =3D $row[0];=0A$phoneResult =3D $ro=
w[1];=0A$emailResult =3D $row[2];=0A=0Aecho "Name =3D $nameResult<BR>";=0Ae=
cho "Phone =3D $phoneResult<BR>";=0Aecho "E-mail =3D $emailResult<BR>";=0A=
=0Apg_Close( $db );=0A?>=0A=0A<H3>Add Okay!</H3>=0A=0A</BODY>=0A</HTML>=0A-=
------------------------------------------------------------ =0AError i get =
is=0AMon Apr 03 18:39:53 2006] [notice] Apache/2.0.54 (Fedora) configured -=
- resuming normal operations=0A[Mon Apr 03 18:42:17 2006] [error] [client 1=
27.0.0.1] File does not exist: /var/www/html/favicon.ico=0A[client 127.0.0.=
1] PHP Warning: pg_connect() [<a href=3D'function.pg-connect'>function.pg-=
connect</a>]: 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=0A[Mon=
Apr 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exist: /var=
/www/html/favicon.ico=0A=0A_________________________________ _______________=
_______=0A=0Afrom the command line it works fine=0Ai.e php add-entry.php wo=
rks fine ( ofcourse adds an empty row into the data base)=0A=0A------------=
--------------------------------------=0A=0Ai did telnet=0A=0A[root [at] localho=
st html]# telnet localhost 5432=0ATrying 127.0.0.1...=0AConnected to localh=
ost.localdomain (127.0.0.1).=0AEscape character is '^]'.=0A=0A=0AConnection=
closed by foreign host.=0A=0Adata/pg_log/postgresql-Mon.log contains=0A=0A=
LOG: invalid length of startup packet=0A=0A=0A=0A-------------------------=
------=0A=0A=0AI am not getting any clue as to how to solve this problem ..=
..let me know if you have any idea in solving this porblem.=0A=0Aregards=0AM=
uralidhar=0A=0A=0A
--Next_1144083971---0-203.199.83.33-19612
Content-type: text/html;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<P>=0A <BR>=0AHi ,<BR>=0AHere is the complete description of the prob=
lem ...<BR>=0A<BR>=0AI have newly installed fedora core 4 with option as ev=
eryting.<BR>=0A<BR>=0Ait comes with apache webserver, postgresql , php-post=
gresql, php-gd etc,<BR>=0A<BR>=0Ait creates a default user postgres with ho=
me =3D /var/lib/psql<BR>=0A<BR>=0A1. i loged in as postgres<BR>=0A<BR>=0A2.=
called initdb<BR>=0A created database under directory ~/data<BR>=0A<=
BR>=0A3. changed postgresql.conf to include<BR>=0A list=
en_addresses =3D '*'<BR>=0A port =3D 5432<BR>=0A<BR>=0A=
4. changed pg_hba.conf<BR>=0A local all all=
 =
; trust<BR>=0A host all all&n=
bsp; 127.0.0.1/32 trust<BR>=0A &nbs=
p; host all all 192.168.1.18/24  =
; trust<BR>=0A host all all &n=
bsp; ::1/128 trust<BR>=0A<BR>=0A5.=
postmaster -i -D ~/data &<BR>=0A<BR>=0A6. createdb AddressBook<BR>=0A<=
BR>=0A7. psql AddressBook<BR>=0A<BR>=0A8. create table addresses( Name text=
, Phone text, Email text);<BR>=0A<BR>=0A9. create user www NOCREATEDB NOCRE=
ATEUSER;<BR>=0A<BR>=0A10. grant all on addresses to www;<BR>=0A<BR>=0A11. f=
rom other terminal i loged in as root<BR>=0A<BR>=0A12. changed /etc/httpd/c=
onf/httpd.conf<BR>=0A<BR>=0A User www<BR>=0A Grou=
p postgres<BR>=0A<BR>=0A13. copied add.html and add-entry.php into director=
y /var/www/html<BR>=0A<BR>=0Aadd.html<BR>=0A-------------------------------=
-----------------------<BR>=0A<HTML><BR>=0A<BODY><BR>=0A<BR>=0A=
<FORM ACTION=3D"add-entry.php" METHOD=3D"GET"><BR=
>=0A<BR>=0A<TABLE BORDER=3D1><BR>=0A <TR><BR>=0A &l=
t;TD><BR>=0A <TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2&=
gt;<BR>=0A <TR><BR>=0A <TD>Name</T=
D><BR>=0A <TD><INPUT TYPE=3D"TEXT" NAME=
=3D"Name" VALUE=3D""></TD><BR>=0A =
</TR><BR>=0A <TR><BR>=0A <TD>P=
hone</TD><BR>=0A <TD><INPUT TYPE=3D"TEXT&q=
uot; NAME=3D"Phone" VALUE=3D""></TD><BR>=0A&nb=
sp; </TR><BR>=0A <TR><BR>=0A &=
lt;TD>E-mail</TD><BR>=0A <TD><INPUT TYPE=3D&=
quot;TEXT" NAME=3D"Email" VALUE=3D""></TD>=
;<BR>=0A </TR><BR>=0A <TR><BR>=0A&nbs=
p; <TD COLSPAN=3D2 ALIGN=3DCENTER><BR>=0A =
<INPUT TYPE=3D"SUBMIT" VALUE=3D"Add Entry"><BR>=
=0A </TD><BR>=0A </TR><BR>=0A &=
lt;/TABLE><BR>=0A </TD><BR>=0A </TR><BR>=0A</=
TABLE><BR>=0A</FORM><BR>=0A<BR>=0A</BODY><BR>=0A</HTML>=
;<BR>=0A--------------------------------------------------<BR>=0Aadd-entry.=
php<BR>=0A--------------------------------------------------<BR>=0A<BR>=0A&=
lt;HTML><BR>=0A<BODY><BR>=0A<?PHP<BR>=0A$db =3D pg_Connect( &qu=
ot;dbname=3DAddressBook user=3Dwww");<BR>=0Aif( !$db )<BR>=0A{<BR>=0A&=
nbsp; echo "Could not connect!";<BR>=0A exit;<BR>=0A}<BR>=
=0A<BR>=0A$Name=3D$_GET['Name'];<BR>=0A$Email=3D$_GET['Email'];<BR>=0A$Phon=
e=3D$_GET['Phone'];<BR>=0A<BR>=0A$query =3D "INSERT INTO Addresses VAL=
UES( '$Name', '$Phone', '$Email' );";<BR>=0A<BR>=0A$result =3D pg_Exec=
( $db, $query );<BR>=0A<BR>=0Aif( !$result )<BR>=0A{<BR>=0A echo &quo=
t;No result set returned!";<BR>=0A exit;<BR>=0A}<BR>=0A<BR>=0A$r=
ows =3D pg_NumRows( $result );<BR>=0A<BR>=0Aif( $rows =3D 0 )<BR>=0A{<BR>=
=0A echo "Add Failed.";<BR>=0A exit;<BR>=0A}<BR>=0A<B=
R>=0A$query =3D "SELECT * FROM Addresses WHERE \"Name\" =3D =
'$Name';";<BR>=0A<BR>=0A$query =3D "SELECT * FROM Addresses WHERE=
\"Name\" =3D '$Name';";<BR>=0A<BR>=0A$result =3D pg_Exec( $=
db, $query );<BR>=0A$row =3D pg_Fetch_Row( $result, 0 );<BR>=0A<BR>=0A$name=
Result =3D $row[0];<BR>=0A$phoneResult =3D $row[1];<BR>=0A$emailResult =3D =
$row[2];<BR>=0A<BR>=0Aecho "Name =3D $nameResult<BR>";<BR>=
=0Aecho "Phone =3D $phoneResult<BR>";<BR>=0Aecho "E-ma=
il =3D $emailResult<BR>";<BR>=0A<BR>=0Apg_Close( $db );<BR>=0A?&=
gt;<BR>=0A<BR>=0A<H3>Add Okay!</H3><BR>=0A<BR>=0A</BODY><=
BR>=0A</HTML><BR>=0A-------------------------------------------------=
------------<BR>=0AError i get is<BR>=0AMon Apr 03 18:39:53 2006] [notice] =
Apache/2.0.54 (Fedora) configured -- resuming normal operations<BR>=0A[Mon =
Apr 03 18:42:17 2006] [error] [client 127.0.0.1] File does not exist: /var/=
www/html/favicon.ico<BR>=0A[client 127.0.0.1] PHP Warning: pg_connect=
() [<a href=3D'function.pg-connect'>function.pg-connect</a>]: U=
nable to connect to PostgreSQL server: could not connect to server: Permiss=
ion denied\n\tIs the server running locally and accepting\n\tconnections on=
Unix domain socket "/tmp/.s.PGSQL.5432"? in /var/www/htm=
l/add-entry.php on line 5, referer: http://localhost/add.html<BR>=0A[Mon Ap=
r 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exist: /var/ww=
w/html/favicon.ico<BR>=0A<BR>=0A___________________________________________=
____________<BR>=0A<BR>=0Afrom the command line it works fine<BR>=0Ai.e php=
add-entry.php works fine ( ofcourse adds an empty row into the data base)<=
BR>=0A<BR>=0A--------------------------------------------------<BR>=0A<BR>=
=0Ai did telnet<BR>=0A<BR>=0A[root [at] localhost html]# telnet localhost 5432<B=
R>=0ATrying 127.0.0.1...<BR>=0AConnected to localhost.localdomain (127.0.0.=
1).<BR>=0AEscape character is '^]'.<BR>=0A<BR>=0A<BR>=0AConnection closed b=
y foreign host.<BR>=0A<BR>=0Adata/pg_log/postgresql-Mon.log contains<BR>=0A=
<BR>=0ALOG: invalid length of startup packet<BR>=0A<BR>=0A<BR>=0A<BR>=
=0A-------------------------------<BR>=0A<BR>=0A<BR>=0AI am not getting any=
clue as to how to solve this problem ...let me know if you have any idea i=
n solving this porblem.<BR>=0A<BR>=0Aregards<BR>=0AMuralidhar<BR>=0A<BR>=0A=
<BR>=0A=0A</P>=0A<br><br>=0A<a href=3D"http://adworks.rediff.com/cgi-bin/Ad=
Works/sigclick.cgi/www.rediff.com/signature-home.htm/1507191 490 [at] Middle5?PAR=
TNER=3D3"><IMG SRC=3D"http://adworks.rediff.com/cgi-bin/AdWorks/sigimpress.=
cgi/www.rediff.com/signature-home.htm/1963059423 [at] Middle5?OAS _query=3Dnull&P=
ARTNER=3D3" BORDER=3D0 VSPACE=3D0 HSPACE=3D0></a>=0A
--Next_1144083971---0-203.199.83.33-19612--
Re: Unable to connect to PostgreSQL Server: Permission denied
--uQr8t48UFsdbeI+V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On 2006-04-03 17:06:11 -0000 (Mon, Apr), muralidhar sortur wrote:
>
> Hi ,
> Here is the complete description of the problem ...
>
> I have newly installed fedora core 4 with option as everyting.
[...]
> ------------------------------------------------------------ -
> Error i get is
> [client 127.0.0.1] PHP Warning: 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
How does the file /tmp/.s.PGSQL.* look like? Does 'www' user have access
to it?
ls -l /tmp/.s.PGSQL.*
As you enabled network interface in postgresql, you may try to add
'host=3D127.0.0.1' to your pg_connect function. This should let 'www'
user to connect.
> [root [at] 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
Telnet is not the best tool for binary protocols.
You may try netcat (nc), but anyway - this test is not significant
here.
By the way, you used this construction:
> $Name=3D$_GET['Name'];
> $Email=3D$_GET['Email'];
> $Phone=3D$_GET['Phone'];
>
> $query =3D "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email' );";
Forgive me if that is only because this is test, and you know that, but
I just HAVE to say:
Don't let the untrusted parameters to go into query. Someone may call
your page like this:
http://example.com/add-entry.php?Email=3Da'); delete from Addresses; --
As *MINIMAL* precaution use:
$Name =3D pg_escape_string( $_GET['Name');
--
No virus found in this outgoing message.
Checked by "grep -i virus $MESSAGE"
Trust me.
--uQr8t48UFsdbeI+V
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEMX8TIzblgXdKMIURAvB8AKCVmy45QPOfaGD5HHDg6f6BVJlaNACg u7Cc
yvIgquNLb3eNvwVa2AK2rfM=
=r9kI
-----END PGP SIGNATURE-----
--uQr8t48UFsdbeI+V--
Re: Unable to connect to PostgreSQL Server: Permission denied
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 =3D /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 =3D '*'
> port =3D 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
> ------------------------------------------------------
> <HTML>
> <BODY>
>
> <FORM ACTION=3D"add-entry.php" METHOD=3D"GET">
>
> <TABLE BORDER=3D1>
> <TR>
> <TD>
> <TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2>
> <TR>
> <TD>Name</TD>
> <TD><INPUT TYPE=3D"TEXT" NAME=3D"Name" VALUE=3D""></TD>
> </TR>
> <TR>
> <TD>Phone</TD>
> <TD><INPUT TYPE=3D"TEXT" NAME=3D"Phone" VALUE=3D""></TD>
> </TR>
> <TR>
> <TD>E-mail</TD>
> <TD><INPUT TYPE=3D"TEXT" NAME=3D"Email" VALUE=3D""></TD>
> </TR>
> <TR>
> <TD COLSPAN=3D2 ALIGN=3DCENTER>
> <INPUT TYPE=3D"SUBMIT" VALUE=3D"Add Entry">
> </TD>
> </TR>
> </TABLE>
> </TD>
> </TR>
> </TABLE>
> </FORM>
>
> </BODY>
> </HTML>
> --------------------------------------------------
> add-entry.php
> --------------------------------------------------
>
> <HTML>
> <BODY>
> <?PHP
> $db =3D pg_Connect( "dbname=3DAddressBook user=3Dwww");
> if( !$db )
> {
> echo "Could not connect!";
> exit;
> }
>
> $Name=3D$_GET['Name'];
> $Email=3D$_GET['Email'];
> $Phone=3D$_GET['Phone'];
>
> $query =3D "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email' )=
;";
>
> $result =3D pg_Exec( $db, $query );
>
> if( !$result )
> {
> echo "No result set returned!";
> exit;
> }
>
> $rows =3D pg_NumRows( $result );
>
> if( $rows =3D 0 )
> {
> echo "Add Failed.";
> exit;
> }
>
> $query =3D "SELECT * FROM Addresses WHERE \"Name\" =3D '$Name';";
>
> $query =3D "SELECT * FROM Addresses WHERE \"Name\" =3D '$Name';";
>
> $result =3D pg_Exec( $db, $query );
> $row =3D pg_Fetch_Row( $result, 0 );
>
> $nameResult =3D $row[0];
> $phoneResult =3D $row[1];
> $emailResult =3D $row[2];
>
> echo "Name =3D $nameResult<BR>";
> echo "Phone =3D $phoneResult<BR>";
> echo "E-mail =3D $emailResult<BR>";
>
> pg_Close( $db );
> ?>
>
> <H3>Add Okay!</H3>
>
> </BODY>
> </HTML>
> ------------------------------------------------------------ -
> 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 exi=
st:
> /var/www/html/favicon.ico
> [client 127.0.0.1] PHP Warning: pg_connect() [<a
> href=3D'function.pg-connect'>function.pg-connect</a>]: Unable to connec=
t 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 o=
n
> line 5, referer: http://localhost/add.html
> [Mon Apr 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exi=
st:
> /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 [at] 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 kno=
w
> if you have any idea in solving this porblem.
>
> regards
> Muralidhar
>
>
>
-------------
nediam.com.mx
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Re: Unable to connect to PostgreSQL Server: Permission denied
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 <DocumentRoot=
"/home/murali/html">=0A ......(as it is)....=0A <DocumentRoot>=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> > <HTML>=0A> > <BODY>=0A> >=0A> > <FORM ACTION=3D"add-entry.php" MET=
HOD=3D"GET">=0A> >=0A> > <TABLE BORDER=3D1>=0A> > <TR>=0A> > <TD>=0A> >=
<TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2>=0A> > <TR>=0A> > =
<TD>Name</TD>=0A> > <TD><INPUT TYPE=3D"TEXT" NAME=3D"Name" VALUE=3D=
""></TD>=0A> > </TR>=0A> > <TR>=0A> > <TD>Phone</TD>=0A> > =
<TD><INPUT TYPE=3D"TEXT" NAME=3D"Phone" VALUE=3D""></TD>=0A> > </TR>=0A=
> > <TR>=0A> > <TD>E-mail</TD>=0A> > <TD><INPUT TYPE=3D"TEXT" N=
AME=3D"Email" VALUE=3D""></TD>=0A> > </TR>=0A> > <TR>=0A> > <TD=
COLSPAN=3D2 ALIGN=3DCENTER>=0A> > <INPUT TYPE=3D"SUBMIT" VALUE=3D"Ad=
d Entry">=0A> > </TD>=0A> > </TR>=0A> > </TABLE>=0A> > </TD>=0A=
> > </TR>=0A> > </TABLE>=0A> > </FORM>=0A> >=0A> > </BODY>=0A> > </HTML>=
=0A> > --------------------------------------------------=0A> > add-entry.p=
hp=0A> > --------------------------------------------------=0A> >=0A> > <HT=
ML>=0A> > <BODY>=0A> > <?PHP=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<BR>";=0A> > echo "Phone =3D =
$phoneResult<BR>";=0A> > echo "E-mail =3D $emailResult<BR>";=0A> >=0A> > pg=
_Close( $db );=0A> > ?>=0A> >=0A> > <H3>Add Okay!</H3>=0A> >=0A> > </BODY>=
=0A> > </HTML>=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() [<a=0A> > href=3D'function.pg-connect'>function.pg-connect</a>]: 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 [at] 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
<P>=0A <BR>=0AHi ,<BR>=0Ain my last mail i forgot to mention that i h=
ave restarted apache server after making changes to the httpd.conf.<BR>=0A<=
BR>=0AToday i made one more experiment ...<BR>=0A<BR>=0A1. changed httpd.co=
nf <BR>=0A<BR>=0A user apache<BR>=0A Group apache=
<BR>=0A<BR>=0A DocumentRoot=3D"/home/murali/html"<BR=
>=0A<BR>=0A <DocumentRoot "/home/murali/html">=
<BR>=0A ......(as it is)....<BR>=0A <DocumentR=
oot><BR>=0A<BR>=0A2. copied the files add.html and add-entry.html to dir=
ectory html under my home directory i.e <BR>=0A<BR>=0A/home/murali/html<BR>=
=0A<BR>=0A3. restarted apache<BR>=0A/usr/sbin/apachectl start ( from root)<=
BR>=0A<BR>=0A4. from postgres login started postmaster.<BR>=0A<BR>=0Apostma=
ster -i -D data&<BR>=0A<BR>=0A5. http://localhost/add.html ( entered Na=
me , Phone , Email)<BR>=0A <BR>=0AEVERY THING WORKED !!!!!<BR>=0A<BR=
>=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<BR>=
=0A<BR>=0A<BR>=0AThanks for all of your help <BR>=0Aregards<BR>=0AMuralidha=
r<BR>=0A<BR>=0AOn Tue, 04 Apr 2006 Javier Carlos wrote :<BR>=0A> =
Did you try to restart the PosgreSQL server using pg_ctl ?<BR>=0A><BR>=
=0A>$ pg_ctl restart<BR>=0A><BR>=0A><BR>=0A> Are y=
ou able to connect as user from the command line?<BR>=0A><BR>=0A>$ ps=
ql AddressBook www<BR>=0A><BR>=0A> Regards,<BR>=0A><BR>=0A&=
gt; Javier<BR>=0A><BR>=0A><BR>=0A> ><BR>=0A> > Hi =
,<BR>=0A> > Here is the complete description of the problem ...<BR>=
=0A> ><BR>=0A> > I have newly installed fedora core 4 with opti=
on as everyting.<BR>=0A> ><BR>=0A> > it comes with apache webse=
rver, postgresql , php-postgresql, php-gd etc,<BR>=0A> ><BR>=0A> &=
gt; it creates a default user postgres with home =3D /var/lib/psql<BR>=0A&g=
t; ><BR>=0A> > 1. i loged in as postgres<BR>=0A> ><BR>=0A>=
; > 2. called initdb<BR>=0A> > created database under direc=
tory ~/data<BR>=0A> ><BR>=0A> > 3. changed postgresql.conf to i=
nclude<BR>=0A> > listen_addresses =3D '*'<BR>=0A=
> > port =3D 5432<BR>=0A> ><BR>=0A> >=
; 4. changed pg_hba.conf<BR>=0A> > local a=
ll all =
trust<BR>=0A> > host =
all all 127.0.0.1/32 trust<BR=
>=0A> > host all all 19=
2.168.1.18/24 trust<BR>=0A> > =
host all all ::1/128 =
trust<BR>=0A> ><BR>=0A> > 5. postmaster -i=
-D ~/data &<BR>=0A> ><BR>=0A> > 6. createdb AddressBook<BR=
>=0A> ><BR>=0A> > 7. psql AddressBook<BR>=0A> ><BR>=0A>=
; > 8. create table addresses( Name text, Phone text, Email text);<BR>=
=0A> ><BR>=0A> > 9. create user www NOCREATEDB NOCREATEUSER;<BR=
>=0A> ><BR>=0A> > 10. grant all on addresses to www;<BR>=0A>=
><BR>=0A> > 11. from other terminal i loged in as root<BR>=0A>=
><BR>=0A> > 12. changed /etc/httpd/conf/httpd.conf<BR>=0A> >=
;<BR>=0A> > User www<BR>=0A> > Grou=
p postgres<BR>=0A> ><BR>=0A> > 13. copied add.html and add-entr=
y.php into directory /var/www/html<BR>=0A> ><BR>=0A> > add.html=
<BR>=0A> > ------------------------------------------------------<BR>=
=0A> > <HTML><BR>=0A> > <BODY><BR>=0A> ><BR>=
=0A> > <FORM ACTION=3D"add-entry.php" METHOD=3D"GET=
"><BR>=0A> ><BR>=0A> > <TABLE BORDER=3D1><BR>=0A&=
gt; > <TR><BR>=0A> > <TD><BR>=0A> >=
; <TABLE BORDER=3D0 CELLPADDING=3D2 CELLSPACING=3D2><BR>=0A>=
; > <TR><BR>=0A> > <TD>Nam=
e</TD><BR>=0A> > <TD><INPUT TYPE=3D"=
;TEXT" NAME=3D"Name" VALUE=3D""></TD><BR>=
=0A> > </TR><BR>=0A> > <TR=
><BR>=0A> > <TD>Phone</TD><BR>=0A> &g=
t; <TD><INPUT TYPE=3D"TEXT" NAME=3D"P=
hone" VALUE=3D""></TD><BR>=0A> > =
</TR><BR>=0A> > <TR><BR>=0A> > =
; <TD>E-mail</TD><BR>=0A> > <TD&=
gt;<INPUT TYPE=3D"TEXT" NAME=3D"Email" VALUE=3D"=
;"></TD><BR>=0A> > </TR><BR>=0A>=
> <TR><BR>=0A> > <TD COLSPAN=
=3D2 ALIGN=3DCENTER><BR>=0A> > <INPUT TYPE=
=3D"SUBMIT" VALUE=3D"Add Entry"><BR>=0A> >&nbs=
p; </TD><BR>=0A> > </TR><BR>=0A>=
> </TABLE><BR>=0A> > </TD><BR>=0A> &=
gt; </TR><BR>=0A> > </TABLE><BR>=0A> > </=
FORM><BR>=0A> ><BR>=0A> > </BODY><BR>=0A> > <=
/HTML><BR>=0A> > -------------------------------------------------=
-<BR>=0A> > add-entry.php<BR>=0A> > ---------------------------=
-----------------------<BR>=0A> ><BR>=0A> > <HTML><BR>=0A=
> > <BODY><BR>=0A> > <?PHP<BR>=0A> > $db =3D pg_=
Connect( "dbname=3DAddressBook user=3Dwww");<BR>=0A> > if( =
!$db )<BR>=0A> > {<BR>=0A> > echo "Could not connec=
t!";<BR>=0A> > exit;<BR>=0A> > }<BR>=0A> ><BR=
>=0A> > $Name=3D$_GET['Name'];<BR>=0A> > $Email=3D$_GET['Email'=
];<BR>=0A> > $Phone=3D$_GET['Phone'];<BR>=0A> ><BR>=0A> >=
$query =3D "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email'=
);";<BR>=0A> ><BR>=0A> > $result =3D pg_Exec( $db, $query=
);<BR>=0A> ><BR>=0A> > if( !$result )<BR>=0A> > {<BR>=0A=
> > echo "No result set returned!";<BR>=0A> >&=
nbsp; exit;<BR>=0A> > }<BR>=0A> ><BR>=0A> > $rows =3D pg=
_NumRows( $result );<BR>=0A> ><BR>=0A> > if( $rows =3D 0 )<BR>=
=0A> > {<BR>=0A> > echo "Add Failed.";<BR>=0A&=
gt; > exit;<BR>=0A> > }<BR>=0A> ><BR>=0A> > $qu=
ery =3D "SELECT * FROM Addresses WHERE \"Name\" =3D '$Name';=
";<BR>=0A> ><BR>=0A> > $query =3D "SELECT * FROM Addr=
esses WHERE \"Name\" =3D '$Name';";<BR>=0A> ><BR>=0A&g=
t; > $result =3D pg_Exec( $db, $query );<BR>=0A> > $row =3D pg_Fet=
ch_Row( $result, 0 );<BR>=0A> ><BR>=0A> > $nameResult =3D $row[=
0];<BR>=0A> > $phoneResult =3D $row[1];<BR>=0A> > $emailResult =
=3D $row[2];<BR>=0A> ><BR>=0A> > echo "Name =3D $nameResul=
t<BR>";<BR>=0A> > echo "Phone =3D $phoneResult<BR&=
gt;";<BR>=0A> > echo "E-mail =3D $emailResult<BR>&quo=
t;;<BR>=0A> ><BR>=0A> > pg_Close( $db );<BR>=0A> > ?><=
BR>=0A> ><BR>=0A> > <H3>Add Okay!</H3><BR>=0A> &=
gt;<BR>=0A> > </BODY><BR>=0A> > </HTML><BR>=0A> =
> ------------------------------------------------------------ -<BR>=0A&g=
t; > Error i get is<BR>=0A> > Mon Apr 03 18:39:53 2006] [notice] A=
pache/2.0.54 (Fedora) configured --<BR>=0A> > resuming normal operati=
ons<BR>=0A> > [Mon Apr 03 18:42:17 2006] [error] [client 127.0.0.1] F=
ile does not exist:<BR>=0A> > /var/www/html/favicon.ico<BR>=0A> &g=
t; [client 127.0.0.1] PHP Warning: pg_connect() [<a<BR>=0A> >=
; href=3D'function.pg-connect'>function.pg-connect</a>]: Unable to=
connect to<BR>=0A> > PostgreSQL server: could not connect to server:=
Permission denied\n\tIs<BR>=0A> > the server running locally and acc=
epting\n\tconnections on Unix domain<BR>=0A> > socket "/tmp/.s.P=
GSQL.5432"? in /var/www/html/add-entry.php on<BR>=0A> > line 5, =
referer: http://localhost/add.html<BR>=0A> > [Mon Apr 03 18:42:22 200=
6] [error] [client 127.0.0.1] File does not exist:<BR>=0A> > /var/www=
/html/favicon.ico<BR>=0A> ><BR>=0A> > _________________________=
______________________________<BR>=0A> ><BR>=0A> > from the com=
mand line it works fine<BR>=0A> > i.e php add-entry.php works fine ( =
ofcourse adds an empty row into the<BR>=0A> > data base)<BR>=0A> &=
gt;<BR>=0A> > --------------------------------------------------<BR>=
=0A> ><BR>=0A> > i did telnet<BR>=0A> ><BR>=0A> > [=
root [at] localhost html]# telnet localhost 5432<BR>=0A> > Trying 127.0.0.=
1...<BR>=0A> > Connected to localhost.localdomain (127.0.0.1).<BR>=0A=
> > Escape character is '^]'.<BR>=0A> ><BR>=0A> ><BR>=0A&=
gt; > Connection closed by foreign host.<BR>=0A> ><BR>=0A> >=
data/pg_log/postgresql-Mon.log contains<BR>=0A> ><BR>=0A> > LO=
G: invalid length of startup packet<BR>=0A> ><BR>=0A> ><B=
R>=0A> ><BR>=0A> > -------------------------------<BR>=0A> &=
gt;<BR>=0A> ><BR>=0A> > I am not getting any clue as to how to =
solve this problem ...let me know<BR>=0A> > if you have any idea in s=
olving this porblem.<BR>=0A> ><BR>=0A> > regards<BR>=0A> >=
; Muralidhar<BR>=0A> ><BR>=0A> ><BR>=0A> ><BR>=0A><BR>=
=0A><BR>=0A><BR>=0A>-------------<BR>=0A>nediam.com.mx<BR>=0A&g=
t;<BR>=0A><BR>=0A>---------------------------(end of broadcast)------=
---------------------<BR>=0A>TIP 5: don't forget to increase your free s=
pace map settings<BR>=0A=0A</P>=0A<br><br>=0A<a href=3D"http://adworks.redi=
ff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature -home.htm/15071=
91490 [at] Middle5?PARTNER=3D3"><IMG SRC=3D"http://adworks.rediff.com/cgi-bin/Ad=
Works/sigimpress.cgi/www.rediff.com/signature-home.htm/19630 59423 [at] Middle5?O=
AS_query=3Dnull&PARTNER=3D3" BORDER=3D0 VSPACE=3D0 HSPACE=3D0></a>=0A
--Next_1144158392---0-203.199.83.42-22090--
Re: Unable to connect to PostgreSQL Server: Permission denied
--0__=0ABBFBD5DFDF2A728f9e8a93df938690918c0ABBFBD5DFDF2A72
Content-type: text/plain; charset=US-ASCII
Perhaps you or your host are running SE Linux?? Depending on your
configuration, users may be forced to run personal websites out of their
home directories.
Cameron
+++++++++++++++++++++++++++++++++++++
Cameron G. Moller, Senior Officer
Technical Project Manager
SSGM Infrastructure
State Street Corporation ... __o
Cell: 617-799-9049 ... -\<,
Desk: 617-664-4501 ... (_)/(_) ..
+++++++++++++++++++++++++++++++++++++
"muralidhar
sortur"
<sorturmuralidhar To
[at] rediffmail.com> "Javier Carlos"
Sent by: <nediam [at] nediam.com.mx>, "Gnanavel
pgsql-php-owner [at] p S" <s.gnanavel [at] gmail.com>,
ostgresql.org "pgsql_php"
<pgsql-php [at] postgresql.org>
cc
04/04/2006 09:46
AM Subject
Re: [PHP] Unable to connect to
PostgreSQL Server: Permission
Please respond to denied
"muralidhar
sortur"
<sorturmuralidhar
[at] rediffmail.com>
Hi ,
in my last mail i forgot to mention that i have restarted apache server
after making changes to the httpd.conf.
Today i made one more experiment ...
1. changed httpd.conf
user apache
Group apache
DocumentRoot="/home/murali/html"
<DocumentRoot "/home/murali/html">
......(as it is)....
<DocumentRoot>
2. copied the files add.html and add-entry.html to directory html under my
home directory i.e
/home/murali/html
3. restarted apache
/usr/sbin/apachectl start ( from root)
4. from postgres login started postmaster.
postmaster -i -D data&
5. http://localhost/add.html ( entered Name , Phone , Email)
EVERY THING WORKED !!!!!
BUT 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
Thanks for all of your help
regards
Muralidhar
On Tue, 04 Apr 2006 Javier Carlos wrote :
> 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
> > ------------------------------------------------------
> > <HTML>
> > <BODY>
> >
> > <FORM ACTION="add-entry.php" METHOD="GET">
> >
> > <TABLE BORDER=1>
> > <TR>
> > <TD>
> > <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2>
> > <TR>
> > <TD>Name</TD>
> > <TD><INPUT TYPE="TEXT" NAME="Name" VALUE=""></TD>
> > </TR>
> > <TR>
> > <TD>Phone</TD>
> > <TD><INPUT TYPE="TEXT" NAME="Phone" VALUE=""></TD>
> > </TR>
> > <TR>
> > <TD>E-mail</TD>
> > <TD><INPUT TYPE="TEXT" NAME="Email" VALUE=""></TD>
> > </TR>
> > <TR>
> > <TD COLSPAN=2 ALIGN=CENTER>
> > <INPUT TYPE="SUBMIT" VALUE="Add Entry">
> > </TD>
> > </TR>
> > </TABLE>
> > </TD>
> > </TR>
> > </TABLE>
> > </FORM>
> >
> > </BODY>
> > </HTML>
> > --------------------------------------------------
> > add-entry.php
> > --------------------------------------------------
> >
> > <HTML>
> > <BODY>
> > <?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<BR>";
> > echo "Phone = $phoneResult<BR>";
> > echo "E-mail = $emailResult<BR>";
> >
> > pg_Close( $db );
> > ?>
> >
> > <H3>Add Okay!</H3>
> >
> > </BODY>
> > </HTML>
> > ------------------------------------------------------------ -
> > 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() [<a
> > href='function.pg-connect'>function.pg-connect</a>]: 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 [at] 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
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: don't forget to increase your free space map settings
(Embedded image moved to file: pic14604.gif)
--0__=0ABBFBD5DFDF2A728f9e8a93df938690918c0ABBFBD5DFDF2A72
Content-type: image/gif;
name="pic14604.gif"
Content-Disposition: attachment; filename="pic14604.gif"
Content-Transfer-Encoding: base64
R0lGODlhQgImALMLAPCxq0I1JtGREpNpG+tjUOUrN/3xAcwGAAAAAP////+w
D////wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFLAELACwA
AAAAQgImAAAE//DIQ5IF8wCbyixcklV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WF64U8WNKYqkanMr7TBcGiJpjSnSc1qWvOa1ixmM/FgmWRucxy6+eYn
winOcppTD6jh1jlRoMN1gqCd7lRmBAAAOw==
--0__=0ABBFBD5DFDF2A728f9e8a93df938690918c0ABBFBD5DFDF2A72
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
--0__=0ABBFBD5DFDF2A728f9e8a93df938690918c0ABBFBD5DFDF2A72--
Re: Unable to connect to PostgreSQL Server: Permission denied
On Mon, Apr 03, 2006 at 10:01:23PM +0200, Mariusz P=EAkala wrote:
> Telnet is not the best tool for binary protocols.
> You may try netcat (nc), but anyway - this test is not significant
> here.
It doesn't matter here.
> Don't let the untrusted parameters to go into query. Someone may call
> your page like this:
> http://example.com/add-entry.php?Email=3Da'); delete from Addresses; --
Nothing wrong will happen.
Regards,
--
Pawe=B3 Bernat; uselessness' lover;
select'<asm'||chr(64)||'asm'||'.'||'flynet'||chr(46)||'pl>'as email;
Slowly and surely the unix crept up on the Nintendo user ...
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Re: Unable to connect to PostgreSQL Server: Permission denied
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On 2006-04-04 19:35:10 +0200 (Tue, Apr), Pawel Bernat wrote:
> On Mon, Apr 03, 2006 at 10:01:23PM +0200, Mariusz P=EAkala wrote:
> > Telnet is not the best tool for binary protocols.
> > You may try netcat (nc), but anyway - this test is not significant
> > here.
> It doesn't matter here.
Okay, you're saying my English isn't perfect ? :-)
> > Don't let the untrusted parameters to go into query. Someone may call
> > your page like this:
> > http://example.com/add-entry.php?Email=3Da'); delete from Addresses; --
> Nothing wrong will happen.
Why?
Unless I really overlooked something, I would humbly disagree.
1) It is possible to put a few sql requests in one string.
2) Relying on 'magic_quotes_gpc' and *possible* addslashes() is a bad thing,
IMHO.
So, where is my mistake?
--
No virus found in this outgoing message.
Checked by "grep -i virus $MESSAGE"
Trust me.
--X1bOJ3K7DJ5YkBrT
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEMuSIIzblgXdKMIURAmHuAKCvMkJUzqQbvCrkNVEPlT3xGq6HgACf Yiwz
iU1v1U7K9P4FHVY/obk9ujg=
=ZvWY
-----END PGP SIGNATURE-----
--X1bOJ3K7DJ5YkBrT--