For the phpPgAdmin users, if you might
help!!!....
I am running PostgreSQL 7.1 over
RedHat.
When trying to connect through the web everything
goes right. A script that is currently working:
<?php
$link =
pg_Connect("host=localhost port=5432
dbname=teste")
or die ("Could not connect"); $comando = "select * from
teste";
$result = pg_exec($link,$comando); $linhas_retornadas = pg_numrows($result); echo
"<table><td><b>nome</b></td><td><b>sobrenome</b>";
for ($i=0; $i < $linhas_retornadas; $i++) { $row=pg_fetch_array($result,$i); echo "<tr><td>" . $row["nome"] . "</td>"; echo "<td>" . $row["sobrenome"] . "</td></tr>"; } echo "</table>"; pg_close
($link);
?> All *my databases are owned by user 'postgres'* and I had to create another PostgreSQL *user 'apache' and give ownership of table 'teste' in database 'teste' to this user* (apache) in order for this connection to work. My 'pg_hba.conf' file
reads:
local all trust host all 127.0.0.1 255.255.255.255 trust With phpPgAdmin I configured file 'config.inc.php'
as follows:
// The default database is used to connect to the
database to check the adv_auth
// This can actually be any database you currently have on your system. It just // needs _a_ database to connect and check the system tables. $cfgDefaultDB = "teste"; // You should change the superuser if different
from postgres
// This is just used to filter out the system functions when listing $cfgSuperUser = "postgres"; // Set to true if you want to authenticate
against the passwd as well as the
username
// In order to use adv_auth, you must update the passwords in the user admin section. // It is suggested that you leave this as false until you are able to get in and update the passwords. $cfgUsePass = false; $cfgServers[1]['local'] = true; $cfgServers[1]['host'] = 'localhost'; $cfgServers[1]['port'] = '5432'; $cfgServers[1]['adv_auth'] = false; $cfgServers[1]['stduser'] = 'apache'; No matter if I set
$cfgServers[1]['host'] as 'localhost' or as '127.0.0.1' $cfgServers[1]['stduser'] as 'apache' or as 'postgres' or as none No matter what I always get a blank Web page with the following messages: ================
ERROR The requested URL could not be retrieved While trying to retrieve the URL: [no URL]
The following error was encountered:
Zero Sized Reply Squid did not receive any data for this request.
Your cache administrator is webmaster. Generated Sun, 04 Mar 2001 23:15:30 GMT by internet.gst.com.br (Squid/2.3.STABLE3) ================ The system tables in PostgreSQL are as
follows:
teste=# select * from
pg_user\g
usename | usesysid | usecreatedb | usetrace | usesuper | usecatupd | passwd | valuntil ----------+----------+-------------+----------+----------+-----------+----------+---------- postgres | 26 | t | t | t | t | ******** | apache | 27 | f | f | f | f | ******** | (2 rows) teste=# select * from pg_shadow\g usename | usesysid | usecreatedb | usetrace | usesuper | usecatupd | passwd | valuntil ----------+----------+-------------+----------+----------+-----------+--------+---------- postgres | 26 | t | t | t | t | | apache | 27 | f | f | f | f | | (2 rows) Please help!!! This shall most probably be some
problem of permission, but how do I manage to make phpPgAdmin to correctly
connect and access my databases?
TIA,
Paulo |
- RE: [GENERAL] [PHP] How to connect to PostgreSQL w... Paulo Parola
- RE: [GENERAL] [PHP] How to connect to Postgre... Juan Ramón Cortabitarte