pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedHelp Conecting to a database from PHP
2+ messages / 2 participants
[nested] [flat]
* Help Conecting to a database from PHP
@ 2003-12-01 15:41 David Cruz Ramos <dcruz@redcolombia.com.co>
2003-12-01 16:53 ` Re: Help Conecting to a database from PHP Mariusz Pekala <skoot@qi.pl>
0 siblings, 1 reply; 2+ messages in thread
From: David Cruz Ramos @ 2003-12-01 15:41 UTC (permalink / raw)
To: pgsql-php
Hi All!
My PC has Slackware Linux 9.1 installed.
And Apache and PHP are working well....I can make and use the PHP functions in my web pages. Recently I've downloaded and installed PostgreSQL 7.3.2, it seems to work well too, I can make databases, tables and all...But when I try to use the PHP functions to connect to the database (pg_connect or pg_pconnect) it doesn't work. I've granted select permission to my user and nobody user in the table of the databse, and my pg_hba.conf seems to be ok ( localhost all all trust ).
The browser even not give any error or something....it just don't work...
I think I'm using the function in the correct way: $conn = pg_connect ("localhost","","","","mydbname");
I've tried too: $conn = pg_connect ("dbname=mydbname");
with and without the port number (5432), and when I type: netstat -nat it shows:
0.0.0.0:5432 LISTEN
in the list
I'm starting the database server in this way: /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data
thanks....
does somebody know what can I do?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Help Conecting to a database from PHP
2003-12-01 15:41 Help Conecting to a database from PHP David Cruz Ramos <dcruz@redcolombia.com.co>
@ 2003-12-01 16:53 ` Mariusz Pekala <skoot@qi.pl>
0 siblings, 0 replies; 2+ messages in thread
From: Mariusz Pekala @ 2003-12-01 16:53 UTC (permalink / raw)
To: pgsql-php; +Cc: David Cruz Ramos <dcruz@redcolombia.com.co>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello.
David Cruz Ramos (pon 1. grudzien 2003 16:41):
> And Apache and PHP are working well....I can make and use the PHP functions
> in my web pages. Recently I've downloaded and installed PostgreSQL 7.3.2,
> [...]
> nobody user in the table of the databse, and my pg_hba.conf seems to be ok
> ( localhost all all trust ). The browser even not give any error or
> something....it just don't work...
Maybe some error messages are in logfiles? Where are log files for yout
postgresql and for your web server?
I suppose you have used wrong format. The line in pg_hba.conf should read:
host all all 127.0.0.1 255.255.255.255 trust
> I think I'm using the function in the correct way: $conn = pg_connect
> ("localhost","","","","mydbname");
If I remember correctly this form has been deprecated...
> I've tried too: $conn = pg_connect ("dbname=mydbname");
> [...]
> I'm starting the database server in this way:
> /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data
>
> thanks....
>
> does somebody know what can I do?
I suppose you may safely drop listening on TCP/IP connections. "local"
connections should be fine.
In that case insert a line into pg_hba.conf:
local all all trust
(...if you want to do it in fast but extremely unsecure way.)
Connecting from PHP you may try to use explicit username, hovewer I think your
problem is in this pg_hba.conf's line with localhost.
Even if your hba_conf is OK, have you enabled "tcpip_socket" in
postgresql.conf?
Maybe there are conflicts with versions of modules used by PHP and your
postgres? Have you had an older version of PostgreSQL before? Have you
recompiled PHP, apache? Just guessing...
- --
[http://skoot.qi.pl for GPG keys]
"A computer programmer is someone who, when told to "Go to Hell", sees
the "Go to", rather than the destination, as harmful."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/y3IxvkWo15WV1rkRAoGhAJ9l/mg/Pihier+tRELkAnO2s2fsjQCeLS9/
15SYAofmao6ttL4ezWUIFLw=
=Ev/N
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-12-01 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-01 15:41 Help Conecting to a database from PHP David Cruz Ramos <dcruz@redcolombia.com.co>
2003-12-01 16:53 ` Mariusz Pekala <skoot@qi.pl>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox