Problems in connecting to postgreSQL using PHP

------=_Part_28883_5127022.1173673517836
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I am trying to connect my postgreSQL with PHP in localhost. I have start up
the server with -i flag (i.e. postmaster -D /usr/local/pgsql/data -i &) and
edit the pg_hba.conf. However, I still cannot connect with the database.
But, when I tried to remote access the database through SSH and I can
connect with it.

Would you please offer any suggestions or solutions?

Many thanks,
Kitty3A

------=_Part_28883_5127022.1173673517836
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>Hi,</div>
<div> </div>
<div>I am trying to connect my postgreSQL with PHP in localhost. I have start up the server with -i flag (i.e. postmaster -D /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still cannot connect with the database. But, when I tried to remote access the database through SSH and I can connect with it.
</div>
<div> </div>
<div>Would you please offer any suggestions or solutions?</div>
<div> </div>
<div>Many thanks,</div>
<div>Kitty3A </div>

------=_Part_28883_5127022.1173673517836--
Kitty Yuen [ Mo, 12 März 2007 05:25 ] [ ID #1654910 ]

Re: Problems in connecting to postgreSQL using PHP

Could you provide any PHP errors or the pg_hba.conf ?

On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:

> Hi,
> =A0
> I am trying to connect my postgreSQL with PHP in localhost. I have
> start up the server with -i flag (i.e. postmaster -D
> /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> cannot connect with the database. But, when I tried to remote access
> the database through SSH and I can connect with it.
> =A0
> Would you please offer any suggestions or solutions?
> =A0
> Many=A0thanks,
> Kitty3A=A0


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Matthew Terenzio [ Mo, 12 März 2007 13:35 ] [ ID #1654911 ]

Re: Problems in connecting to postgreSQL using PHP

--Apple-Mail-23--22643105
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=ISO-8859-1;
delsp=yes;
format=flowed

how do i get off this list?

On Mar 12, 2007, at 12:35 PM, Matthew Terenzio wrote:

> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
>> Hi,
>>
>> I am trying to connect my postgreSQL with PHP in localhost. I have
>> start up the server with -i flag (i.e. postmaster -D /usr/local/
>> pgsql/data -i &) and edit the pg_hba.conf. However, I still cannot
>> connect with the database. But, when I tried to remote access the
>> database through SSH and I can connect with it.
>>
>> Would you please offer any suggestions or solutions?
>>
>> Many thanks,
>> Kitty3A
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Thomas Schindler . Geschäftsführer
hundertelf GmbH . HRB 52839
Philippstraße 6 . 50823 Köln
fon +49 (0)221 - 5897566
cel +49 (0)162 - 9034568
fax +49 (0)221 - 35569618
thomas.schindler [at] hundertelf.com
www.hundertelf.com



--Apple-Mail-23--22643105
Content-Transfer-Encoding: base64
Content-Type: text/directory;
x-unix-mode=0644;
x-mac-hide-extension=yes;
name=Thomas Schindler.vcf
Content-Disposition: attachment;
filename="Thomas Schindler.vcf"

AEIARQBHAEkATgA6AFYAQwBBAFIARAANAAoAVgBFAFIAUwBJAE8ATgA6ADMA
LgAwAA0ACgBOADoAUwBjAGgAaQBuAGQAbABlAHIAOwBUAGgAbwBtAGEAcwA7
ADsAOwANAAoARgBOADoAVABoAG8AbQBhAHMAIABTAGMAaABpAG4AZABsAGUA
cgANAAoATwBSAEcAOgBoAHUAbgBkAGUAcgB0AGUAbABmACAARwBtAGIASAA7
AA0ACgBFAE0AQQBJAEwAOwB0AHkAcABlAD0ASQBOAFQARQBSAE4ARQBUADsA
dAB5AHAAZQA9AFcATwBSAEsAOwB0AHkAcABlAD0AcAByAGUAZgA6AHQAaABv
AG0AYQBzAC4AcwBjAGgAaQBuAGQAbABlAHIAQABoAHUAbgBkAGUAcgB0AGUA
bABmAC4AYwBvAG0ADQAKAFQARQBMADsAdAB5AHAAZQA9AFcATwBSAEsAOgAw
ADAANAA5AC4AMgAyADEALgA1ADgAOQA3ADUANgA2AA0ACgBUAEUATAA7AHQA
eQBwAGUAPQBDAEUATABMADsAdAB5AHAAZQA9AHAAcgBlAGYAOgAwADAANAA5
AC4AMQA2ADIAIAA5ADAAMwA0ADUANgA4AA0ACgBUAEUATAA7AHQAeQBwAGUA
PQBXAE8AUgBLADsAdAB5AHAAZQA9AEYAQQBYADoAMAAwADQAOQAuADIAMgAx
AC4AMwA1ADUANgA5ADYAMQA4AA0ACgBpAHQAZQBtADEALgBBAEQAUgA7AHQA
eQBwAGUAPQBXAE8AUgBLADsAdAB5AHAAZQA9AHAAcgBlAGYAOgA7ADsAUABo
AGkAbABpAHAAcABzAHQAcgBhAN8AZQAgADYAOwBDAG8AbABvAGcAbgBlADsA
OwA1ADAAOAAyADMAOwBHAGUAcgBtAGEAbgB5AA0ACgBpAHQAZQBtADEALgBY
AC0AQQBCAEEARABSADoAZABlAA0ACgBpAHQAZQBtADIALgBYAC0AQQBCAFIA
RQBMAEEAVABFAEQATgBBAE0ARQBTADsAdAB5AHAAZQA9AHAAcgBlAGYAOgBo
AHQAdABwAFwAOgAvAC8AdwB3AHcALgBoAHUAbgBkAGUAcgB0AGUAbABmAC4A
YwBvAG0ADQAKAGkAdABlAG0AMgAuAFgALQBBAEIATABhAGIAZQBsADoAdwBl
AGIAcwBpAHQAZQANAAoAWAAtAEEAQgBVAEkARAA6ADMARABCAEMAMQA0AEYA
NgAtADgAMQBGADIALQAxADEARAA5AC0AQQBGAEUAOQAtADAAMAAxADEAMgA0
ADMANgA3ADIAQQAyAFwAOgBBAEIAUABlAHIAcwBvAG4ADQAKAEUATgBEADoA
VgBDAEEAUgBEAA0ACg==

--Apple-Mail-23--22643105
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed




--Apple-Mail-23--22643105
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--Apple-Mail-23--22643105--
Thomas Schindler [ Mo, 12 März 2007 14:19 ] [ ID #1654912 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_309_32254814.1173706657141
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi!!! I'm Venezuelan and I don't know how to speak english very well, so
excuse me if i make a mistake.

About the connection: Did you do your script by yourself?, or copied a
functional one?

As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?

Here is my connection script, it is completly good check it out to see if
you have anything wrong

<? /*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuser"; //change it

pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");

?>

That's all what I can do for now

2007/3/12, Matthew Terenzio <matt [at] jobsforge.com>:
>
> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
> > Hi,
> >
> > I am trying to connect my postgreSQL with PHP in localhost. I have
> > start up the server with -i flag (i.e. postmaster -D
> > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> > cannot connect with the database. But, when I tried to remote access
> > the database through SSH and I can connect with it.
> >
> > Would you please offer any suggestions or solutions?
> >
> > Manythanks,
> > Kitty3A
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>



--
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal

Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II

Tel=E9fonos: Celular: (0416) 4131418

E-mail: valentinorfila [at] gmail.com
valentinorfila [at] hotmail.com
josevalentinorfila [at] yahoo.com

Messenger: valentinorfila [at] hotmail.com

Skype: valentinorfila
valentinorfila [at] gmail.com
************************************************************ ***************

------=_Part_309_32254814.1173706657141
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.<br><br>About the connection: Did you d=
o your script by yourself?, or copied a functional one?<br><br>As <span id=
=3D"_user_ts [at] schindlermedia.com" style=3D"color: rgb(91, 16, 148);">
Thomas Schindler </span>said, send us any PHP errors or the pg_hba.conf ?<b=
r><br>Here is my connection script, it is completly good check it out to se=
e if you have anything wrong<br><br><?  /*---------------*/<br>&nbs=
p;   $servidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br>     $password =3D "postgresuser"; /=
/change it<br>   <br>     pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=

<br>   <br>?><br><br>That's all what I can do for now<br><=
br><div><span class=3D"gmail_quote">2007/3/12, Matthew Terenzio <<a href=
=3D"mailto:matt [at] jobsforge.com">matt [at] jobsforge.com</a>>:</span><blockquot=
e class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204);=
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:<br><br>> Hi,<br>> <br>> I am try=
ing to connect my postgreSQL with PHP in localhost. I have<br>> start up=
the server with -i flag (
i.e. postmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still<br>> cannot connect with the database. But, w=
hen I tried to remote access<br>> the database through SSH and I can con=
nect with it.
<br>> <br>> Would you please offer any suggestions or solutions?<br>&=
gt; <br>> Manythanks,<br>> Kitty3A<br><br><br>-----------------------=
----(end of broadcast)---------------------------<br>TIP 2: Don't '=
kill -9' the postmaster
<br></blockquote></div><br><br clear=3D"all"><br>-- <br>*******************=
********************************************************<br>Ministerio de P=
lanificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela <br>=
Direcci=F3n de Planes de Personal
<br><br>Jos=E9 Valent=EDn Orfila Brice=F1o<br>Programador II <br><br>Tel=E9=
fonos: Celular: (0416) 4131418<br><br>E-mail: <a href=3D"mailto:valentinorf=
ila [at] gmail.com">valentinorfila [at] gmail.com</a><br>    &nbs=
p;      <a href=3D"mailto:valentinorfila [at] hotmail.c=
om">
valentinorfila [at] hotmail.com</a><br>       =
;    <a href=3D"mailto:josevalentinorfila [at] yahoo.com">joseval=
entinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valentinorfil=
a [at] hotmail.com">valentinorfila [at] hotmail.com</a><br><br>
Skype: valentinorfila<br>        &n=
bsp;  <a href=3D"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail=
..com</a><br> ************************************************************ ***=
************

------=_Part_309_32254814.1173706657141--
valentinorfila [ Mo, 12 März 2007 14:37 ] [ ID #1654913 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_346_12666678.1173706882724
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

here is the script again

<? /*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuserpassword"; //change it

pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");

?>

2007/3/12, Valent=EDn Orfila <valentinorfila [at] gmail.com>:
>
> Hi!!! I'm Venezuelan and I don't know how to speak english very well, so
> excuse me if i make a mistake.
>
> About the connection: Did you do your script by yourself?, or copied a
> functional one?
>
> As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
>
> Here is my connection script, it is completly good check it out to see if
> you have anything wrong
>
> <? /*---------------*/
> $servidor =3D "localhost";
> $base =3D "databasename"; //change it
> $usuario =3D "postgresuser"; //change it
> $password =3D "postgresuser"; //change it
>
> pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> password=3D$password");
>
> ?>
>
> That's all what I can do for now
>
> 2007/3/12, Matthew Terenzio <matt [at] jobsforge.com>:
> >
> > Could you provide any PHP errors or the pg_hba.conf ?
> >
> > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> >
> > > Hi,
> > >
> > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > start up the server with -i flag ( i.e. postmaster -D
> > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I stil=
l
> > > cannot connect with the database. But, when I tried to remote access
> > > the database through SSH and I can connect with it.
> > >
> > > Would you please offer any suggestions or solutions?
> > >
> > > Manythanks,
> > > Kitty3A
> >
> >
> > ---------------------------(end of broadcast)--------------------------=
-
> > TIP 2: Don't 'kill -9' the postmaster
> >
>
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila [at] gmail.com
> valentinorfila [at] hotmail.com
> josevalentinorfila [at] yahoo.com
>
> Messenger: valentinorfila [at] hotmail.com
>
> Skype: valentinorfila
> valentinorfila [at] gmail.com
> ************************************************************ *************=
**
>




--
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal

Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II

Tel=E9fonos: Celular: (0416) 4131418

E-mail: valentinorfila [at] gmail.com
valentinorfila [at] hotmail.com
josevalentinorfila [at] yahoo.com

Messenger: valentinorfila [at] hotmail.com

Skype: valentinorfila
valentinorfila [at] gmail.com
************************************************************ ***************

------=_Part_346_12666678.1173706882724
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

here is the script again<br><br><?  /*---------------*/<br> &n=
bsp;  $servidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br>     $password =3D "postgresuserpassword&=
quot;; //change it<br>   <br>     pg_pconnect=
("host=3D$servidor dbname=3D$base user=3D$usuario password=3D$password=
");
<br>   <br>?><br><br><div><span class=3D"gmail_quote">2007/3/1=
2, Valent=EDn Orfila <<a href=3D"mailto:valentinorfila [at] gmail.com">valent=
inorfila [at] gmail.com</a>>:</span><blockquote class=3D"gmail_quote" style=
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;">
Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.<br><br>About the connection: Did you d=
o your script by yourself?, or copied a functional one?<br><br>As <span sty=
le=3D"color: rgb(91, 16, 148);">

Thomas Schindler </span>said, send us any PHP errors or the pg_hba.conf ?<b=
r><br>Here is my connection script, it is completly good check it out to se=
e if you have anything wrong<br><br><?  /*---------------*/<br>&nbs=
p;   $servidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br>     $password =3D "postgresuser"; /=
/change it<br>   <br>     pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=

<br>   <br>?><br><br>That's all what I can do for now<br><=
br><div><span class=3D"gmail_quote">2007/3/12, Matthew Terenzio <<a href=
=3D"mailto:matt [at] jobsforge.com" target=3D"_blank" onclick=3D"return top.js.O=
penExtLink(window,event,this)">
matt [at] jobsforge.com</a>>:</span><div><span class=3D"e" id=3D"q_111465e4de=
c01adc_1"><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid=
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:<br><br>> Hi,<br>> <br>> I am try=
ing to connect my postgreSQL with PHP in localhost. I have<br>> start up=
the server with -i flag (
i.e. postmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still<br>> cannot connect with the database. But, w=
hen I tried to remote access<br>> the database through SSH and I can con=
nect with it.
<br>> <br>> Would you please offer any suggestions or solutions?<br>&=
gt; <br>> Manythanks,<br>> Kitty3A<br><br><br>-----------------------=
----(end of broadcast)---------------------------<br>TIP 2: Don't '=
kill -9' the postmaster
<br></blockquote></span></div></div><br><br clear=3D"all"><br>-- <br>******=
************************************************************ *********<br>Mi=
nisterio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de V=
enezuela
<br>Direcci=F3n de Planes de Personal
<br><br>Jos=E9 Valent=EDn Orfila Brice=F1o<br>Programador II <br><br>Tel=E9=
fonos: Celular: (0416) 4131418<br><br>E-mail: <a href=3D"mailto:valentinorf=
ila [at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">
valentinorfila [at] gmail.com</a><br>       &=
nbsp;   <a href=3D"mailto:valentinorfila [at] hotmail.com" target=3D"_=
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila [at] hotmail.com</a><br>       =
;    <a href=3D"mailto:josevalentinorfila [at] yahoo.com" target=
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valentinorfi=
la [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">
valentinorfila [at] hotmail.com</a><br><br>
Skype: valentinorfila<br>        &n=
bsp;  <a href=3D"mailto:valentinorfila [at] gmail.com" target=3D"_blank" on=
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila [at] gmail=
..com</a><br> ************************************************************ ***=
************
</blockquote></div><br><br clear=3D"all"><br>-- <br>***********************=
****************************************************<br>Ministerio de Plani=
ficaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela <br>Dire=
cci=F3n de Planes de Personal
<br><br>Jos=E9 Valent=EDn Orfila Brice=F1o<br>Programador II <br><br>Tel=E9=
fonos: Celular: (0416) 4131418<br><br>E-mail: <a href=3D"mailto:valentinorf=
ila [at] gmail.com">valentinorfila [at] gmail.com</a><br>    &nbs=
p;      <a href=3D"mailto:valentinorfila [at] hotmail.c=
om">
valentinorfila [at] hotmail.com</a><br>       =
;    <a href=3D"mailto:josevalentinorfila [at] yahoo.com">joseval=
entinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valentinorfil=
a [at] hotmail.com">valentinorfila [at] hotmail.com</a><br><br>
Skype: valentinorfila<br>        &n=
bsp;  <a href=3D"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail=
..com</a><br> ************************************************************ ***=
************

------=_Part_346_12666678.1173706882724--
valentinorfila [ Mo, 12 März 2007 14:41 ] [ ID #1654914 ]

Re: Problems in connecting to postgreSQL using PHP

Thomas Schindler wrote:
> how do i get off this list?

Find where you subscribed and choose the unsubscribe option?

Click the unsubscribe link that appears randomly in the footers?

Or even follow the links in the email headers included with every email.

List-Unsubscribe: <mailto:majordomo [at] postgresql.org?body=unsub%20pgsql-php>

--
Postgresql & php tutorials
http://www.designmagick.com/

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
dmagick [ Di, 13 März 2007 00:09 ] [ ID #1654915 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_18150_5808283.1173752833101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Here are my error messages from PHP:


[Mon Mar 12 16:01:26 2007] [error] [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/try.php on line 3

[Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning:
pg_last_error()
[<a href='function.pg-last-error'>function.pg-last-error</a>]: No PostgreSQL
link opened yet in /var/www/html/try.php on line 4

PHP Code:


<?php

// Connecting, selecting database

$dbconn = pg_connect("dbname=test user=postgres")

or die('Could not connect: ' . pg_last_error());



// Performing SQL query

$query = 'SELECT * FROM haha';

$result = pg_query($query) or die('Query failed: ' . pg_last_error());



// Printing results in HTML

echo "<table>\n";

while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {

echo "\t<tr>\n";

foreach ($line as $col_value) {

echo "\t\t<td>$col_value</td>\n";

}

echo "\t</tr>\n";

}

echo "</table>\n";



// Free resultset

pg_free_result($result);



// Closing connection

pg_close($dbconn);



*pg_hba.cof*

# TYPE DATABASE USER CIDR-ADDRESS METHOD



# "local" is for Unix domain socket connections only

local all all trust



# IPv4 local connections:

host all all 127.0.0.1/32 trust

# IPv6 local connections:

host all all ::1/128 trust

*postgresql.conf*


#----------------------------------------------------------- ----------------

# CONNECTIONS AND AUTHENTICATION

#----------------------------------------------------------- ----------------



# - Connection Settings -



listen_addresses = 'localhost' # what IP address(es) to listen
on;

# comma-separated list of addresses;

# defaults to 'localhost', '*' = all

port = 5432

max_connections = 100

# note: increasing max_connections costs ~400 bytes of shared memory per

# connection slot, plus lock space (see max_locks_per_transaction). You

# might also need to raise shared_buffers to support more connections.

superuser_reserved_connections = 2

unix_socket_directory = ''

unix_socket_group = ''

unix_socket_permissions = 0777 # octal
bonjour_name = '' # defaults to the computer name

Thanks a lot,
Kitty3A






On 3/12/07, Matthew Terenzio <matt [at] jobsforge.com> wrote:
>
> Could you provide any PHP errors or the pg_hba.conf ?
>
> On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
>
> > Hi,
> >
> > I am trying to connect my postgreSQL with PHP in localhost. I have
> > start up the server with -i flag (i.e. postmaster -D
> > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
> > cannot connect with the database. But, when I tried to remote access
> > the database through SSH and I can connect with it.
> >
> > Would you please offer any suggestions or solutions?
> >
> > Manythanks,
> > Kitty3A
>
>

------=_Part_18150_5808283.1173752833101
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>Here are my error messages from PHP:</div>
<div> </div>
<div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">[Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning:<span style="mso-spacerun: yes">
  </span>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 &quot;/tmp/.s.PGSQL.5432&quot;? in /var/www/html/try.php on line 3
</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">[Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning:<span style="mso-spacerun: yes">
  </span>pg_last_error() [<a href='function.pg-last-error'>function.pg-last-error</a>]: No PostgreSQL link opened yet in /var/www/html/try.php on line 4</font></span></p></div>
<div> </div>
<div>PHP Code:</div>
<div> </div>
<div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><?php</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">// Connecting, selecting database</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">$dbconn = pg_connect("dbname=test user=postgres")</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">   </span>or die('Could not connect: ' . pg_last_error());</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">// Performing SQL query</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">$query = 'SELECT * FROM haha';</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">$result = pg_query($query) or die('Query failed: ' . pg_last_error());</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">// Printing results in HTML</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">echo "<table>\n";</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">   </span>echo "\t<tr>\n";</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">   </span>foreach ($line as $col_value) {</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">       </span>echo "\t\t<td>$col_value</td>\n";</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">   </span>}</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">   </span>echo "\t</tr>\n";</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">}</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">echo "</table>\n";</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">// Free resultset</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">pg_free_result($result);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">// Closing connection</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">pg_close($dbconn);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"></font></span> </p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><u><strong>pg_hba.cof</strong></u></font></span></p><span lang="EN-US">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># TYPE<span style="mso-spacerun: yes">  </span>DATABASE<span style="mso-spacerun: yes">    </span>USER<span style="mso-spacerun: yes">
        </span>CIDR-ADDRESS<span style="mso-spacerun: yes">          </span>METHOD</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># "local" is for Unix domain socket connections only</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">local<span style="mso-spacerun: yes">   </span>all<span style="mso-spacerun: yes">         </span>all<span style="mso-spacerun: yes">
                               </span>trust</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># IPv4 local connections:</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">host<span style="mso-spacerun: yes">    </span>all<span style="mso-spacerun: yes">         </span>all<span style="mso-spacerun: yes">
         </span>127.0.0.1/32<span style="mso-spacerun: yes">          </span>trust</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># IPv6 local connections:</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">host<span style="mso-spacerun: yes">    </span>all<span style="mso-spacerun: yes">         </span>all<span style="mso-spacerun: yes">
         </span>::1/128<span style="mso-spacerun: yes">               </span>trust</font></span></p></span></div>
<div> </div>
<div><u><strong>postgresql.conf</strong></u><br> </div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> #----------------------------------------------------------- ----------------</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># CONNECTIONS AND AUTHENTICATION</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> #----------------------------------------------------------- ----------------</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># - Connection Settings -</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"> </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">listen_addresses = 'localhost'<span style="mso-tab-count: 2">             </span># what IP address(es) to listen on;
</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-tab-count: 5">                                        </span># comma-separated list of addresses;</font></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"><span style="mso-tab-count: 5">                                        </span># defaults to 'localhost', '*' = all
</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">port = 5432</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">max_connections = 100</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># note: increasing max_connections costs ~400 bytes of shared memory per </font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># connection slot, plus lock space (see max_locks_per_transaction).<span style="mso-spacerun: yes">  </span>You</font></span>
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman"># might also need to raise shared_buffers to support more connections.</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">superuser_reserved_connections = 2</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">unix_socket_directory = ''</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">unix_socket_group = ''</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">unix_socket_permissions = 0777<span style="mso-tab-count: 2">              </span># octal</font></span></p>
<div class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><font face="Times New Roman">bonjour_name = ''<span style="mso-tab-count: 3">                     </span># defaults to the computer name</font>
</span></div>
<div class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"></span> </div>
<div>Thanks a lot,</div>
<div>Kitty3A</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div><br> </div>
<div><span class="gmail_quote">On 3/12/07, <b class="gmail_sendername">Matthew Terenzio</b> <matt [at] jobsforge.com> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Could you provide any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
<br><br>> Hi,<br>> <br>> I am trying to connect my postgreSQL with PHP in localhost. I have<br>> start up the server with -i flag (i.e. postmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I still
<br>> cannot connect with the database. But, when I tried to remote access<br>> the database through SSH and I can connect with it.<br>> <br>> Would you please offer any suggestions or solutions?<br>> <br>> Manythanks,
<br>> Kitty3A<br><br></blockquote></div><br>

------=_Part_18150_5808283.1173752833101--
Kitty Yuen [ Di, 13 März 2007 03:27 ] [ ID #1656076 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_39759_4138752.1173835607267
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Dear Valent=EDn,

I think I have already enabled the extension and found the extension in my
pgsql.ini file in php.d folder. However, I still cannot connect to the
database. I guess I have something to be config in the PostgreSQL. Do you
have any ideas?


Kitty3a

On 3/13/07, Valent=EDn Orfila <valentinorfila [at] gmail.com> wrote:
>
> OK. Now you have to activate the library to connect PHP to PostgreSQL,
> this is in the php.ini file. In Windows 2000 it is in the following
> folders: C:\WINNT and in the PHP installation folder, in my case:
> C:\AppServ\php. Once you find this file you have to discomment this
> extension: extension=3Dphp_pgsql.dll, to do that you are going to erase t=
he
> ";" at the beggining of the line.
>
> Look for this file (php.ini) in your O.S. and configured it. If you are
> using Linux I guess it is in the etc/profile/php.config directory, but I0=
m
> not sure.
>
> I'm attaching you my file:
>
>
> 2007/3/12, Kitty Yuen <kitty3a [at] gmail.com>:
> >
> > Here are my error messages from PHP:
> >
> >
> > [Mon Mar 12 16:01:26 2007] [error] [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/try.php =
on
> > line 3
> >
> > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: pg=
_last_error()
> > [<a href=3D'function.pg-last-error'>function.pg-last-error</a>]: No
> > PostgreSQL link opened yet in /var/www/html/try.php on line 4
> >
> > PHP Code:
> >
> >
> > <?php
> >
> > // Connecting, selecting database
> >
> > $dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres")
> >
> > or die('Could not connect: ' . pg_last_error());
> >
> >
> >
> > // Performing SQL query
> >
> > $query =3D 'SELECT * FROM haha';
> >
> > $result =3D pg_query($query) or die('Query failed: ' . pg_last_error())=
;
> >
> >
> >
> > // Printing results in HTML
> >
> > echo "<table>\n";
> >
> > while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {
> >
> > echo "\t<tr>\n";
> >
> > foreach ($line as $col_value) {
> >
> > echo "\t\t<td>$col_value</td>\n";
> >
> > }
> >
> > echo "\t</tr>\n";
> >
> > }
> >
> > echo "</table>\n";
> >
> >
> >
> > // Free resultset
> >
> > pg_free_result($result);
> >
> >
> >
> > // Closing connection
> >
> > pg_close($dbconn);
> >
> >
> >
> > *pg_hba.cof*
> >
> > # TYPE DATABASE USER CIDR-ADDRESS METHOD
> >
> >
> >
> > # "local" is for Unix domain socket connections only
> >
> > local all all trust
> >
> >
> >
> > # IPv4 local connections:
> >
> > host all all 127.0.0.1/32 trust
> >
> > # IPv6 local connections:
> >
> > host all all ::1/128 trust
> >
> > *postgresql.conf*
> >
> >
> >
> > #----------------------------------------------------------- -----------=
-----
> >
> > # CONNECTIONS AND AUTHENTICATION
> >
> >
> > #----------------------------------------------------------- -----------=
-----
> >
> >
> >
> > # - Connection Settings -
> >
> >
> >
> > listen_addresses =3D 'localhost' # what IP address(es) to
> > listen on;
> >
> > # comma-separated list of
> > addresses;
> >
> > # defaults to 'localhost', '*' =
=3D
> > all
> >
> > port =3D 5432
> >
> > max_connections =3D 100
> >
> > # note: increasing max_connections costs ~400 bytes of shared memory pe=
r
> >
> >
> > # connection slot, plus lock space (see max_locks_per_transaction). Yo=
u
> >
> > # might also need to raise shared_buffers to support more connections.
> >
> > superuser_reserved_connections =3D 2
> >
> > unix_socket_directory =3D ''
> >
> > unix_socket_group =3D ''
> >
> > unix_socket_permissions =3D 0777 # octal
> > bonjour_name =3D '' # defaults to the computer name
> >
> > Thanks a lot,
> > Kitty3A
> >
> >
> >
> >
> >
> >
> > On 3/12/07, Matthew Terenzio <matt [at] jobsforge.com > wrote:
> > >
> > > Could you provide any PHP errors or the pg_hba.conf ?
> > >
> > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > > start up the server with -i flag (i.e. postmaster -D
> > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > still
> > > > cannot connect with the database. But, when I tried to remote acces=
s
> > > > the database through SSH and I can connect with it.
> > > >
> > > > Would you please offer any suggestions or solutions?
> > > >
> > > > Manythanks,
> > > > Kitty3A
> > >
> > >
> >
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila [at] gmail.com
> valentinorfila [at] hotmail.com
> josevalentinorfila [at] yahoo.com
>
> Messenger: valentinorfila [at] hotmail.com
>
> Skype: valentinorfila
> valentinorfila [at] gmail.com
> ************************************************************ *************=
**
>
>
>

------=_Part_39759_4138752.1173835607267
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Dear <span class=3D"gmail_quote"><b class=3D"gmail_sendername">Valent=EDn,<=
br><br></b><span class=3D"gmail_sendername">I think I have already enabled =
the extension and found the extension in my pgsql.ini file in php.d folder.=
However, I still cannot connect to the database. I guess I have something =
to be config in the PostgreSQL. Do you have any ideas?
<br><br><br>Kitty3a<br></span></span><br><div><span class=3D"gmail_quote">O=
n 3/13/07, <b class=3D"gmail_sendername">Valent=EDn Orfila</b> <<a href=
=3D"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail.co m</a>> wrote=
:</span>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK. Now you have =
to activate the library to connect PHP to PostgreSQL, this is in the php.in=
i
file. In Windows 2000 it is in the following folders: C:\WINNT and in the =
PHP installation folder, in my case: C:\AppServ\php. Once you find this fil=
e you have to discomment this extension: extension=3Dphp_pgsql.dll, to do t=
hat you are going to erase the ";" at the beggining of the line.
<br><br>Look for this file (php.ini) in your O.S. and configured it. If you=
are using Linux I guess it is in the etc/profile/php.config directory, but=
I0m not sure. <br><br>I'm attaching you my file:<br><br><br><div>
<span class=3D"gmail_quote">
2007/3/12, Kitty Yuen <<a href=3D"mailto:kitty3a [at] gmail.com" target=3D"_b=
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">kitty3a [at] gmai=
l.com</a>>:</span><div><span class=3D"e" id=3D"q_1114b7061633b0ed_1"><bl=
ockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204=
, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>Here are my error messages from PHP:</div>
<div> </div>
<div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client <a href=3D"http://127=
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">

127.0.0.1</a>] PHP Warning:<span>
  </span>pg_connect() [<a href=3D'function.pg-connect'>f=
unction.pg-connect</a>]: Unable to connect to PostgreSQL server: coul=
d not connect to server: Permission denied\n\tIs the server running locally=
and accepting\n\tconnections on Unix domain socket &quot;/tmp/.s.PGSQL=
..5432&quot;? in /var/www/html/try.php on line 3
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client <a href=3D"http://127=
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">

127.0.0.1</a>] PHP Warning:<span>
  </span>pg_last_error() [<a href=3D'function.pg-last-error'=
;>function.pg-last-error</a>]: No PostgreSQL link opened yet in /v=
ar/www/html/try.php on line 4</font></span></p></div>
<div> </div>
<div>PHP Code:</div>
<div> </div>
<div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><?php</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Connecting, selecting database</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres"=
)</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>or die('Could not connect: ' .=
pg_last_error());</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Performing SQL query</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$query =3D 'SELECT * FROM haha';</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$result =3D pg_query($query) or die('Query failed: ' . p=
g_last_error());</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Printing results in HTML</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">echo "<table>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {</=
font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>echo "\t<tr>\n";</font=
></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>foreach ($line as $col_value) {</font>=
</span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>       </span>echo "\t\=
t<td>$col_value</td>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>}</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>echo "\t</tr>\n";</fon=
t></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">}</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">echo "</table>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Free resultset</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">pg_free_result($result);</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Closing connection</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">pg_close($dbconn);</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"></font></span> </p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><u><strong>pg_hba.cof</strong></u></font></span></p><span lang=
=3D"EN-US">
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># TYPE<span>  </span>DATABASE<span>    </spa=
n>USER<span>
        </span>CIDR-ADDRESS<span> &=
nbsp;        </span>METHOD</font></span>=
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># "local" is for Unix domain socket connections only</=
font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">local<span>   </span>all<span>    =
     </span>all<span>
            &nb=
sp;            =
      </span>trust</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># IPv4 local connections:</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">host<span>    </span>all<span>   &=
nbsp;     </span>all<span>
         </span><a href=3D"http://1=
27.0.0.1/32" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,=
event,this)">127.0.0.1/32</a><span>      &nbs=
p;   </span>trust</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># IPv6 local connections:</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">host<span>    </span>all<span>   &=
nbsp;     </span>all<span>
         </span>::1/128<span> =
            &nb=
sp; </span>trust</font></span></p></span></div>
<div> </div>
<div><u><strong>postgresql.conf</strong></u><br> </div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">#---------------------------------------------------- -----------=
------------</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># CONNECTIONS AND AUTHENTICATION</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">#---------------------------------------------------- -----------=
------------</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># - Connection Settings -</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">listen_addresses =3D 'localhost'<span>   =
          </span># what IP add=
ress(es) to listen on;
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>         &nbs=
p;            &=
nbsp;           &nbs=
p;     </span># comma-separated list of addresses;</fon=
t></span>
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>         &nbs=
p;            &=
nbsp;           &nbs=
p;     </span># defaults to 'localhost', '*=
' =3D all
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">port =3D 5432</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">max_connections =3D 100</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># note: increasing max_connections costs ~400 bytes of shared me=
mory per </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># connection slot, plus lock space (see max_locks_per_transactio=
n).<span>  </span>You</font></span>
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># might also need to raise shared_buffers to support more connec=
tions.</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">superuser_reserved_connections =3D 2</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_directory =3D ''</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_group =3D ''</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_permissions =3D 0777<span>    &n=
bsp;         </span># octal</font><=
/span></p>
<div style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Time=
s New Roman">bonjour_name =3D ''<span>     =
;            &n=
bsp;   </span># defaults to the computer name</font>
</span></div>
<div style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"></span> </div=
>
<div>Thanks a lot,</div>
<div>Kitty3A</div><div><span>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div><br> </div>
<div><span class=3D"gmail_quote">On 3/12/07, <b class=3D"gmail_sendername">=
Matthew Terenzio</b> <<a href=3D"mailto:matt [at] jobsforge.com" target=3D"_b=
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">matt [at] jobsfor=
ge.com
</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Could you provide=
any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 2007, at 12:25 AM, K=
itty Yuen wrote:
<br><br>> Hi,<br>> <br>> I am trying to connect my postgreSQL with=
PHP in localhost. I have<br>> start up the server with -i flag (i.e. po=
stmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_hba.con=
f. However, I still
<br>> cannot connect with the database. But, when I tried to remote acce=
ss<br>> the database through SSH and I can connect with it.<br>> <br>=
> Would you please offer any suggestions or solutions?<br>> <br>

> Manythanks,
<br>> Kitty3A<br><br></blockquote></div><br>
</span></div></blockquote></span></div></div><br><br clear=3D"all"><div><sp=
an class=3D"e" id=3D"q_1114b7061633b0ed_3"><br>-- <br>*********************=
******************************************************<br>Ministerio de Pla=
nificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venezuela
<br>Direcci=F3n de Planes de Personal<br><br>Jos=E9 Valent=EDn Orfila Brice=
=F1o<br>Programador II <br><br>Tel=E9fonos: Celular: (0416) 4131418<br><br>=
E-mail: <a href=3D"mailto:valentinorfila [at] gmail.com" target=3D"_blank" oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila [at] gmail.com</a><br>
           <a href=3D"mai=
lto:valentinorfila [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.=
OpenExtLink(window,event,this)">valentinorfila [at] hotmail.com</a><br> &nb=
sp;         <a href=3D"mailto:josev=
alentinorfila [at] yahoo.com" target=3D"_blank" onclick=3D"return top.js.OpenExt=
Link(window,event,this)">
josevalentinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valent=
inorfila [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLin=
k(window,event,this)">
valentinorfila [at] hotmail.com</a><br><br>Skype: valentinorfila<br>  =
         <a href=3D"mailto:valentin=
orfila [at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wi=
ndow,event,this)">valentinorfila [at] gmail.com</a><br>*************************=
**************************************************
</span></div><br clear=3D"all"></blockquote></div><br>

------=_Part_39759_4138752.1173835607267--
Kitty Yuen [ Mi, 14 März 2007 02:26 ] [ ID #1657244 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_33554_18530516.1173895619919
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Kitty,

Try try using this function: pg_pconnect("host=3D$servidor dbname=3D$base
user=3D$usuario password=3D$password");, I mean, use the connection script =
I'm
going to paste below.

<? /*---------------*/
$servidor =3D "localhost";
$base =3D "databasename"; //change it
$usuario =3D "postgresuser"; //change it
$password =3D "postgresuserpassword"; //change it

pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
password=3D$password");

?>



2007/3/12, Valent=EDn Orfila <valentinorfila [at] gmail.com>:
>
> here is the script again
>
> <? /*---------------*/
> $servidor =3D "localhost";
> $base =3D "databasename"; //change it
> $usuario =3D "postgresuser"; //change it
> $password =3D "postgresuserpassword"; //change it
>
> pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> password=3D$password");
>
> ?>
>
> 2007/3/12, Valent=EDn Orfila <valentinorfila [at] gmail.com>:
> >
> > Hi!!! I'm Venezuelan and I don't know how to speak english very well, s=
o
> > excuse me if i make a mistake.
> >
> > About the connection: Did you do your script by yourself?, or copied a
> > functional one?
> >
> > As Thomas Schindler said, send us any PHP errors or the pg_hba.conf ?
> >
> > Here is my connection script, it is completly good check it out to see
> > if you have anything wrong
> >
> > <? /*---------------*/
> > $servidor =3D "localhost";
> > $base =3D "databasename"; //change it
> > $usuario =3D "postgresuser"; //change it
> > $password =3D "postgresuser"; //change it
> >
> > pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usuario
> > password=3D$password");
> >
> > ?>
> >
> > That's all what I can do for now
> >
> > 2007/3/12, Matthew Terenzio < matt [at] jobsforge.com>:
> > >
> > > Could you provide any PHP errors or the pg_hba.conf ?
> > >
> > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to connect my postgreSQL with PHP in localhost. I have
> > > > start up the server with -i flag ( i.e. postmaster -D
> > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > still
> > > > cannot connect with the database. But, when I tried to remote acces=
s
> > > > the database through SSH and I can connect with it.
> > > >
> > > > Would you please offer any suggestions or solutions?
> > > >
> > > > Manythanks,
> > > > Kitty3A
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 2: Don't 'kill -9' the postmaster
> > >
> >
> >
> >
> > --
> >
> > ************************************************************ ***********=
****
> > Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivarian=
a de
> > Venezuela
> > Direcci=F3n de Planes de Personal
> >
> > Jos=E9 Valent=EDn Orfila Brice=F1o
> > Programador II
> >
> > Tel=E9fonos: Celular: (0416) 4131418
> >
> > E-mail: valentinorfila [at] gmail.com
> > valentinorfila [at] hotmail.com
> > josevalentinorfila [at] yahoo.com
> >
> > Messenger: valentinorfila [at] hotmail.com
> >
> > Skype: valentinorfila
> > valentinorfila [at] gmail.com
> > ************************************************************ ***********=
****
> >
>
>
>
>
> --
>
> ************************************************************ *************=
**
> Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana =
de
> Venezuela
> Direcci=F3n de Planes de Personal
>
> Jos=E9 Valent=EDn Orfila Brice=F1o
> Programador II
>
> Tel=E9fonos: Celular: (0416) 4131418
>
> E-mail: valentinorfila [at] gmail.com
> valentinorfila [at] hotmail.com
> josevalentinorfila [at] yahoo.com
>
> Messenger: valentinorfila [at] hotmail.com
>
> Skype: valentinorfila
> valentinorfila [at] gmail.com
> ************************************************************ *************=
**
>
>



--
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal

Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II

Tel=E9fonos: Celular: (0416) 4131418

E-mail: valentinorfila [at] gmail.com
valentinorfila [at] hotmail.com
josevalentinorfila [at] yahoo.com

Messenger: valentinorfila [at] hotmail.com

Skype: valentinorfila
valentinorfila [at] gmail.com
************************************************************ ***************

------=_Part_33554_18530516.1173895619919
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Kitty, <br><br><span class=3D"q">Try try using this function: pg_pconnect(&=
quot;host=3D$servidor dbname=3D$base user=3D$usuario password=3D$password&q=
uot;);, I mean, use the connection script I'm going to paste below.<br>=
<br></span>
<span class=3D"q"><?  /*---------------*/<br>    $se=
rvidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br></span>     $password =3D "postgresuserpa=
ssword"; //change it<span class=3D"q"><br>   <br>  =
;   pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usu=
ario password=3D$password");
<br>   <br>?><br></span><br><span class=3D"q"><br></span><br><=
div><span class=3D"gmail_quote">2007/3/12, Valent=EDn Orfila <<a href=3D=
"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail.com</a>>:</span><=
blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2=
04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
here is the script again<span class=3D"q"><br><br><?  /*-----------=
----*/<br>    $servidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br></span>     $password =3D "postgresuserpa=
ssword"; //change it<span class=3D"q"><br>   <br>  =
;   pg_pconnect("host=3D$servidor dbname=3D$base user=3D$usu=
ario password=3D$password");
<br>   <br>?><br><br></span><div><span class=3D"gmail_quote">2=
007/3/12, Valent=EDn Orfila <<a href=3D"mailto:valentinorfila [at] gmail.com"=
target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)"=
>valentinorfila [at] gmail.com
</a>>:</span><div><span class=3D"e" id=3D"q_1114661bf257d8ee_5"><blockqu=
ote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204=
); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!!! I'm Venezuelan and I don't know how to speak english very wel=
l, so excuse me if i make a mistake.<br><br>About the connection: Did you d=
o your script by yourself?, or copied a functional one?<br><br>As <span sty=
le=3D"color: rgb(91, 16, 148);">


Thomas Schindler </span>said, send us any PHP errors or the pg_hba.conf ?<b=
r><br>Here is my connection script, it is completly good check it out to se=
e if you have anything wrong<br><br><?  /*---------------*/<br>&nbs=
p;   $servidor =3D "localhost";
<br>     $base =3D "databasename"; //change i=
t<br>     $usuario =3D "postgresuser"; //chan=
ge it<br>     $password =3D "postgresuser"; /=
/change it<br>   <br>     pg_pconnect("h=
ost=3D$servidor dbname=3D$base user=3D$usuario password=3D$password");=

<br>   <br>?><br><br>That's all what I can do for now<br><=
br><div><span class=3D"gmail_quote">2007/3/12, Matthew Terenzio <<a href=
=3D"mailto:matt [at] jobsforge.com" target=3D"_blank" onclick=3D"return top.js.O=
penExtLink(window,event,this)">

matt [at] jobsforge.com</a>>:</span><div><span><blockquote class=3D"gmail_quo=
te" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt=
0.8ex; padding-left: 1ex;">
Could you provide any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 200=
7, at 12:25 AM, Kitty Yuen wrote:<br><br>> Hi,<br>> <br>> I am try=
ing to connect my postgreSQL with PHP in localhost. I have<br>> start up=
the server with -i flag (
i.e. postmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_=
hba.conf. However, I still<br>> cannot connect with the database. But, w=
hen I tried to remote access<br>> the database through SSH and I can con=
nect with it.
<br>> <br>> Would you please offer any suggestions or solutions?<br>&=
gt; <br>> Manythanks,<br>> Kitty3A<br><br><br>-----------------------=
----(end of broadcast)---------------------------<br>TIP 2: Don't '=
kill -9' the postmaster
<br></blockquote></span></div></div><br><br clear=3D"all"><br>-- <br>******=
************************************************************ *********<br>Mi=
nisterio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de V=
enezuela
<br>Direcci=F3n de Planes de Personal
<br><br>Jos=E9 Valent=EDn Orfila Brice=F1o<br>Programador II <br><br>Tel=E9=
fonos: Celular: (0416) 4131418<br><br>E-mail: <a href=3D"mailto:valentinorf=
ila [at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">

valentinorfila [at] gmail.com</a><br>       &=
nbsp;   <a href=3D"mailto:valentinorfila [at] hotmail.com" target=3D"_=
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila [at] hotmail.com</a><br>       =
;    <a href=3D"mailto:josevalentinorfila [at] yahoo.com" target=
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valentinorfi=
la [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">

valentinorfila [at] hotmail.com</a><br><br>
Skype: valentinorfila<br>        &n=
bsp;  <a href=3D"mailto:valentinorfila [at] gmail.com" target=3D"_blank" on=
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila [at] gmail=
..com</a><br> ************************************************************ ***=
************
</blockquote></span></div></div><div><span class=3D"e" id=3D"q_1114661bf257=
d8ee_7"><br><br clear=3D"all"><br>-- <br>**********************************=
*****************************************<br>Ministerio de Planificaci=F3n =
y Desarrollo de la Rep=FAblica Bolivariana de Venezuela
<br>Direcci=F3n de Planes de Personal
<br><br>Jos=E9 Valent=EDn Orfila Brice=F1o<br>Programador II <br><br>Tel=E9=
fonos: Celular: (0416) 4131418<br><br>E-mail: <a href=3D"mailto:valentinorf=
ila [at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(windo=
w,event,this)">
valentinorfila [at] gmail.com</a><br>       &=
nbsp;   <a href=3D"mailto:valentinorfila [at] hotmail.com" target=3D"_=
blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">
valentinorfila [at] hotmail.com</a><br>       =
;    <a href=3D"mailto:josevalentinorfila [at] yahoo.com" target=
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">joseva=
lentinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valentinorfi=
la [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wind=
ow,event,this)">
valentinorfila [at] hotmail.com</a><br><br>
Skype: valentinorfila<br>        &n=
bsp;  <a href=3D"mailto:valentinorfila [at] gmail.com" target=3D"_blank" on=
click=3D"return top.js.OpenExtLink(window,event,this)">valentinorfila [at] gmail=
..com</a><br> ************************************************************ ***=
************
</span></div></blockquote></div><br><br clear=3D"all"><br>-- <br>**********=
************************************************************ *****<br>Minist=
erio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venez=
uela
<br>Direcci=F3n de Planes de Personal<br><br>Jos=E9 Valent=EDn Orfila Brice=
=F1o<br>Programador II <br><br>Tel=E9fonos: Celular: (0416) 4131418<br><br>=
E-mail: <a href=3D"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail.co=
m</a><br>
           <a href=3D"mai=
lto:valentinorfila [at] hotmail.com">valentinorfila [at] hotmail.com</a><br> &nb=
sp;         <a href=3D"mailto:josev=
alentinorfila [at] yahoo.com">josevalentinorfila [at] yahoo.com</a><br><br>Messenger:=
<a href=3D"mailto:valentinorfila [at] hotmail.com">
valentinorfila [at] hotmail.com</a><br><br>Skype: valentinorfila<br>  =
         <a href=3D"mailto:valentin=
orfila [at] gmail.com">valentinorfila [at] gmail.com</a><br>*************************=
**************************************************

------=_Part_33554_18530516.1173895619919--
valentinorfila [ Mi, 14 März 2007 19:06 ] [ ID #1657245 ]

Re: Problems in connecting to postgreSQL using PHP

------=_Part_33402_18509013.1173895152489
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I already told you all I thought, but...

Below is the local config in my pg_hba and i just see you have one line mor=
e
than me, do you use Unix? if not, so erase that line and try again

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 trust

# IPv6 local connections:
localhost all all ::1/128 trust




2007/3/13, Kitty Yuen <kitty3a [at] gmail.com>:
>
> Dear Valent=EDn,
>
> I think I have already enabled the extension and found the extension in m=
y
> pgsql.ini file in php.d folder. However, I still cannot connect to the
> database. I guess I have something to be config in the PostgreSQL. Do you
> have any ideas?
>
>
> Kitty3a
>
> On 3/13/07, Valent=EDn Orfila <valentinorfila [at] gmail.com> wrote:
> >
> > OK. Now you have to activate the library to connect PHP to PostgreSQL,
> > this is in the php.ini file. In Windows 2000 it is in the following
> > folders: C:\WINNT and in the PHP installation folder, in my case:
> > C:\AppServ\php. Once you find this file you have to discomment this
> > extension: extension=3Dphp_pgsql.dll, to do that you are going to erase=
the
> > ";" at the beggining of the line.
> >
> > Look for this file (php.ini) in your O.S. and configured it. If you are
> > using Linux I guess it is in the etc/profile/php.config directory, but =
I0m
> > not sure.
> >
> > I'm attaching you my file:
> >
> >
> > 2007/3/12, Kitty Yuen <kitty3a [at] gmail.com>:
> > >
> > > Here are my error messages from PHP:
> > >
> > >
> > > [Mon Mar 12 16:01:26 2007] [error] [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/try.ph=
p on
> > > line 3
> > >
> > > [Mon Mar 12 16:01:26 2007] [error] [client 127.0.0.1] PHP Warning: =
pg_last_error()
> > > [<a href=3D'function.pg-last-error'>function.pg-last-error</a>]: No
> > > PostgreSQL link opened yet in /var/www/html/try.php on line 4
> > >
> > > PHP Code:
> > >
> > >
> > > <?php
> > >
> > > // Connecting, selecting database
> > >
> > > $dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres")
> > >
> > > or die('Could not connect: ' . pg_last_error());
> > >
> > >
> > >
> > > // Performing SQL query
> > >
> > > $query =3D 'SELECT * FROM haha';
> > >
> > > $result =3D pg_query($query) or die('Query failed: ' . pg_last_error(=
));
> > >
> > >
> > >
> > > // Printing results in HTML
> > >
> > > echo "<table>\n";
> > >
> > > while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {
> > >
> > > echo "\t<tr>\n";
> > >
> > > foreach ($line as $col_value) {
> > >
> > > echo "\t\t<td>$col_value</td>\n";
> > >
> > > }
> > >
> > > echo "\t</tr>\n";
> > >
> > > }
> > >
> > > echo "</table>\n";
> > >
> > >
> > >
> > > // Free resultset
> > >
> > > pg_free_result($result);
> > >
> > >
> > >
> > > // Closing connection
> > >
> > > pg_close($dbconn);
> > >
> > >
> > >
> > > *pg_hba.cof*
> > >
> > > # TYPE DATABASE USER CIDR-ADDRESS METHOD
> > >
> > >
> > >
> > > # "local" is for Unix domain socket connections only
> > >
> > > local all all trust
> > >
> > >
> > >
> > > # IPv4 local connections:
> > >
> > > host all all 127.0.0.1/32 trust
> > >
> > > # IPv6 local connections:
> > >
> > > host all all ::1/128 trust
> > >
> > > *postgresql.conf*
> > >
> > >
> > >
> > > #----------------------------------------------------------- ---------=
-------
> > >
> > > # CONNECTIONS AND AUTHENTICATION
> > >
> > >
> > > #----------------------------------------------------------- ---------=
-------
> > >
> > >
> > >
> > > # - Connection Settings -
> > >
> > >
> > >
> > > listen_addresses =3D 'localhost' # what IP address(es) to
> > > listen on;
> > >
> > > # comma-separated list of
> > > addresses;
> > >
> > > # defaults to 'localhost', '*=
'
> > > =3D all
> > >
> > > port =3D 5432
> > >
> > > max_connections =3D 100
> > >
> > > # note: increasing max_connections costs ~400 bytes of shared memory
> > > per
> > >
> > > # connection slot, plus lock space (see max_locks_per_transaction).
> > > You
> > >
> > > # might also need to raise shared_buffers to support more connections=
..
> > >
> > > superuser_reserved_connections =3D 2
> > >
> > > unix_socket_directory =3D ''
> > >
> > > unix_socket_group =3D ''
> > >
> > > unix_socket_permissions =3D 0777 # octal
> > > bonjour_name =3D '' # defaults to the computer na=
me
> > >
> > > Thanks a lot,
> > > Kitty3A
> > >
> > >
> > >
> > >
> > >
> > >
> > > On 3/12/07, Matthew Terenzio <matt [at] jobsforge.com > wrote:
> > > >
> > > > Could you provide any PHP errors or the pg_hba.conf ?
> > > >
> > > > On Mar 12, 2007, at 12:25 AM, Kitty Yuen wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to connect my postgreSQL with PHP in localhost. I hav=
e
> > > > > start up the server with -i flag (i.e. postmaster -D
> > > > > /usr/local/pgsql/data -i &) and edit the pg_hba.conf. However, I
> > > > still
> > > > > cannot connect with the database. But, when I tried to remote
> > > > access
> > > > > the database through SSH and I can connect with it.
> > > > >
> > > > > Would you please offer any suggestions or solutions?
> > > > >
> > > > > Manythanks,
> > > > > Kitty3A
> > > >
> > > >
> > >
> >
> >
> > --
> >
> > ************************************************************ ***********=
****
> > Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivarian=
a de
> > Venezuela
> > Direcci=F3n de Planes de Personal
> >
> > Jos=E9 Valent=EDn Orfila Brice=F1o
> > Programador II
> >
> > Tel=E9fonos: Celular: (0416) 4131418
> >
> > E-mail: valentinorfila [at] gmail.com
> > valentinorfila [at] hotmail.com
> > josevalentinorfila [at] yahoo.com
> >
> > Messenger: valentinorfila [at] hotmail.com
> >
> > Skype: valentinorfila
> > valentinorfila [at] gmail.com
> > ************************************************************ ***********=
****
> >
> >
> >
>


--
************************************************************ ***************
Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de
Venezuela
Direcci=F3n de Planes de Personal

Jos=E9 Valent=EDn Orfila Brice=F1o
Programador II

Tel=E9fonos: Celular: (0416) 4131418

E-mail: valentinorfila [at] gmail.com
valentinorfila [at] hotmail.com
josevalentinorfila [at] yahoo.com

Messenger: valentinorfila [at] hotmail.com

Skype: valentinorfila
valentinorfila [at] gmail.com
************************************************************ ***************

------=_Part_33402_18509013.1173895152489
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I already told you all I thought, but...<br><br>Below is the local config i=
n my pg_hba and i just see you have one line more than me, do you use Unix?=
if not, so erase that line and try again<br><br># TYPE  DATABASE =
;   USER        CIDR-ADDRESS&n=
bsp;         METHOD
<br><br># IPv4 local connections:<br>host    all  =
       all      =
;   <a href=3D"http://127.0.0.1/32">127.0.0.1/32</a>  &=
nbsp;         trust<br><br># IPv6 l=
ocal connections:<br>localhost    all    =
;     all       &nbs=
p; ::1/128           =
;    trust
<br><br><br><br><br><div><span class=3D"gmail_quote">2007/3/13, Kitty Yuen =
<<a href=3D"mailto:kitty3a [at] gmail.com">kitty3a [at] gmail.com</a>>:</span><=
blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2=
04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear <span class=3D"gmail_quote"><b class=3D"gmail_sendername">Valent=EDn,<=
br><br></b><span class=3D"gmail_sendername">I think I have already enabled =
the extension and found the extension in my pgsql.ini file in php.d folder.=
However, I still cannot connect to the database. I guess I have something =
to be config in the PostgreSQL. Do you have any ideas?
<br><br><br>Kitty3a<br></span></span><div><span class=3D"e" id=3D"q_1114e0d=
ec80a2bca_1"><br><div><span class=3D"gmail_quote">On 3/13/07, <b class=3D"g=
mail_sendername">Valent=EDn Orfila</b> <<a href=3D"mailto:valentinorfila=
[at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,e=
vent,this)">
valentinorfila [at] gmail.com</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">OK. Now you have =
to activate the library to connect PHP to PostgreSQL, this is in the php.in=
i

file. In Windows 2000 it is in the following folders: C:\WINNT and in the =
PHP installation folder, in my case: C:\AppServ\php. Once you find this fil=
e you have to discomment this extension: extension=3Dphp_pgsql.dll, to do t=
hat you are going to erase the ";" at the beggining of the line.
<br><br>Look for this file (php.ini) in your O.S. and configured it. If you=
are using Linux I guess it is in the etc/profile/php.config directory, but=
I0m not sure. <br><br>I'm attaching you my file:<br><br><br><div>

<span class=3D"gmail_quote">
2007/3/12, Kitty Yuen <<a href=3D"mailto:kitty3a [at] gmail.com" target=3D"_b=
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">kitty3a [at] gmai=
l.com</a>>:</span><div><span><blockquote class=3D"gmail_quote" style=3D"=
border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; paddi=
ng-left: 1ex;">


<div>Here are my error messages from PHP:</div>
<div> </div>
<div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client <a href=3D"http://127=
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">


127.0.0.1</a>] PHP Warning:<span>
  </span>pg_connect() [<a href=3D'function.pg-connect'>f=
unction.pg-connect</a>]: Unable to connect to PostgreSQL server: coul=
d not connect to server: Permission denied\n\tIs the server running locally=
and accepting\n\tconnections on Unix domain socket &quot;/tmp/.s.PGSQL=
..5432&quot;? in /var/www/html/try.php on line 3
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">[Mon Mar 12 16:01:26 2007] [error] [client <a href=3D"http://127=
..0.0.1" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event=
,this)">


127.0.0.1</a>] PHP Warning:<span>
  </span>pg_last_error() [<a href=3D'function.pg-last-error'=
;>function.pg-last-error</a>]: No PostgreSQL link opened yet in /v=
ar/www/html/try.php on line 4</font></span></p></div>
<div> </div>
<div>PHP Code:</div>
<div> </div>
<div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><?php</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Connecting, selecting database</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$dbconn =3D pg_connect("dbname=3Dtest user=3Dpostgres"=
)</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>or die('Could not connect: ' .=
pg_last_error());</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Performing SQL query</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$query =3D 'SELECT * FROM haha';</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">$result =3D pg_query($query) or die('Query failed: ' . p=
g_last_error());</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Printing results in HTML</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">echo "<table>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">while ($line =3D pg_fetch_array($result, null, PGSQL_ASSOC)) {</=
font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>echo "\t<tr>\n";</font=
></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>foreach ($line as $col_value) {</font>=
</span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>       </span>echo "\t\=
t<td>$col_value</td>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>}</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>   </span>echo "\t</tr>\n";</fon=
t></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">}</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">echo "</table>\n";</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Free resultset</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">pg_free_result($result);</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">// Closing connection</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">pg_close($dbconn);</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"></font></span> </p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><u><strong>pg_hba.cof</strong></u></font></span></p><span lang=
=3D"EN-US">
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># TYPE<span>  </span>DATABASE<span>    </spa=
n>USER<span>
        </span>CIDR-ADDRESS<span> &=
nbsp;        </span>METHOD</font></span>=
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># "local" is for Unix domain socket connections only</=
font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">local<span>   </span>all<span>    =
     </span>all<span>
            &nb=
sp;            =
      </span>trust</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># IPv4 local connections:</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">host<span>    </span>all<span>   &=
nbsp;     </span>all<span>
         </span><a href=3D"http://1=
27.0.0.1/32" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,=
event,this)">127.0.0.1/32</a><span>      &nbs=
p;   </span>trust</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># IPv6 local connections:</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">host<span>    </span>all<span>   &=
nbsp;     </span>all<span>
         </span>::1/128<span> =
            &nb=
sp; </span>trust</font></span></p></span></div>
<div> </div>
<div><u><strong>postgresql.conf</strong></u><br> </div>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">#---------------------------------------------------- -----------=
------------</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># CONNECTIONS AND AUTHENTICATION</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">#---------------------------------------------------- -----------=
------------</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># - Connection Settings -</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"> </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">listen_addresses =3D 'localhost'<span>   =
          </span># what IP add=
ress(es) to listen on;
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>         &nbs=
p;            &=
nbsp;           &nbs=
p;     </span># comma-separated list of addresses;</fon=
t></span>
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"><span>         &nbs=
p;            &=
nbsp;           &nbs=
p;     </span># defaults to 'localhost', '*=
' =3D all
</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">port =3D 5432</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">max_connections =3D 100</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># note: increasing max_connections costs ~400 bytes of shared me=
mory per </font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># connection slot, plus lock space (see max_locks_per_transactio=
n).<span>  </span>You</font></span>
</p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman"># might also need to raise shared_buffers to support more connec=
tions.</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">superuser_reserved_connections =3D 2</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_directory =3D ''</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_group =3D ''</font></span></p>
<p style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Times =
New Roman">unix_socket_permissions =3D 0777<span>    &n=
bsp;         </span># octal</font><=
/span></p>
<div style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"><font face=3D"Time=
s New Roman">bonjour_name =3D ''<span>     =
;            &n=
bsp;   </span># defaults to the computer name</font>
</span></div>
<div style=3D"margin: 0cm 0cm 0pt;"><span lang=3D"EN-US"></span> </div=
>
<div>Thanks a lot,</div>
<div>Kitty3A</div><div><span>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div><br> </div>
<div><span class=3D"gmail_quote">On 3/12/07, <b class=3D"gmail_sendername">=
Matthew Terenzio</b> <<a href=3D"mailto:matt [at] jobsforge.com" target=3D"_b=
lank" onclick=3D"return top.js.OpenExtLink(window,event,this)">matt [at] jobsfor=
ge.com
</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Could you provide=
any PHP errors or the pg_hba.conf ?<br><br>On Mar 12, 2007, at 12:25 AM, K=
itty Yuen wrote:
<br><br>> Hi,<br>> <br>> I am trying to connect my postgreSQL with=
PHP in localhost. I have<br>> start up the server with -i flag (i.e. po=
stmaster -D<br>> /usr/local/pgsql/data -i &) and edit the pg_hba.con=
f. However, I still
<br>> cannot connect with the database. But, when I tried to remote acce=
ss<br>> the database through SSH and I can connect with it.<br>> <br>=
> Would you please offer any suggestions or solutions?<br>> <br>


> Manythanks,
<br>> Kitty3A<br><br></blockquote></div><br>
</span></div></blockquote></span></div></div><br><br clear=3D"all"><div><sp=
an><br>-- <br> ************************************************************ *=
**************<br>Ministerio de Planificaci=F3n y Desarrollo de la Rep=FAbl=
ica Bolivariana de Venezuela
<br>Direcci=F3n de Planes de Personal<br><br>Jos=E9 Valent=EDn Orfila Brice=
=F1o<br>Programador II <br><br>Tel=E9fonos: Celular: (0416) 4131418<br><br>=
E-mail: <a href=3D"mailto:valentinorfila [at] gmail.com" target=3D"_blank" oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)">

valentinorfila [at] gmail.com</a><br>
           <a href=3D"mai=
lto:valentinorfila [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.=
OpenExtLink(window,event,this)">valentinorfila [at] hotmail.com</a><br> &nb=
sp;         <a href=3D"mailto:josev=
alentinorfila [at] yahoo.com" target=3D"_blank" onclick=3D"return top.js.OpenExt=
Link(window,event,this)">

josevalentinorfila [at] yahoo.com</a><br><br>Messenger: <a href=3D"mailto:valent=
inorfila [at] hotmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLin=
k(window,event,this)">
valentinorfila [at] hotmail.com</a><br><br>Skype: valentinorfila<br>  =
         <a href=3D"mailto:valentin=
orfila [at] gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(wi=
ndow,event,this)">valentinorfila [at] gmail.com</a><br>*************************=
**************************************************
</span></div><br clear=3D"all"></blockquote></div><br>
</span></div></blockquote></div><br><br clear=3D"all"><br>-- <br>**********=
************************************************************ *****<br>Minist=
erio de Planificaci=F3n y Desarrollo de la Rep=FAblica Bolivariana de Venez=
uela
<br>Direcci=F3n de Planes de Personal<br><br>Jos=E9 Valent=EDn Orfila Brice=
=F1o<br>Programador II <br><br>Tel=E9fonos: Celular: (0416) 4131418<br><br>=
E-mail: <a href=3D"mailto:valentinorfila [at] gmail.com">valentinorfila [at] gmail.co=
m</a><br>
           <a href=3D"mai=
lto:valentinorfila [at] hotmail.com">valentinorfila [at] hotmail.com</a><br> &nb=
sp;         <a href=3D"mailto:josev=
alentinorfila [at] yahoo.com">josevalentinorfila [at] yahoo.com</a><br><br>Messenger:=
<a href=3D"mailto:valentinorfila [at] hotmail.com">
valentinorfila [at] hotmail.com</a><br><br>Skype: valentinorfila<br>  =
         <a href=3D"mailto:valentin=
orfila [at] gmail.com">valentinorfila [at] gmail.com</a><br>*************************=
**************************************************

------=_Part_33402_18509013.1173895152489--
valentinorfila [ Mi, 14 März 2007 18:59 ] [ ID #1657246 ]
Datenbanken » gmane.comp.db.postgresql.php » Problems in connecting to postgreSQL using PHP

Vorheriges Thema: listen_addresses
Nächstes Thema: need help with pg_connect