Thread: Debian php3+postgresql unable to connect
I have Debian 2.1 PostgreSQL 6.5.3 with PHP 3.0.5 e php-pgsql module I have set up everything. Apache works, php works, pgsql module is loaded but this is the message whe i try to connect to the db: Unable to connect to PostgresSQL server: connectDB() failed: Is the postmaster running and accepting TCP/IP(with -i) connections at 'bigpaul' on port '5432'? in /var/www/ciao.php3 on line 34 The sintax to connect to the db is: <?PHP $dbserver = "bigpaul"; //bigpaul is my server name $dbport = "5432"; $database = "gestione"; $conn = pg_Connect ("host=$dbserver port=$dbport dbname=$database"); if (!$conn) { // Errore accesso al database echo "Si è verificato un errore.\n"; } else { pg_Exec................ In the documentation it is written that if you have this kind of problem it means that: 1) the postmaster it is not running 2) you have not specified the server name. But: I have the capabilities to use psql so I think that the postmaster is running (I can create db, tables etc.) I have specified, omitted, declared as "127.0.0.1" the server name So what can I do? Thanks G. -- LDR - Linux Domande e Risposte: http://web.tiscalinet.it/linuxfaq Pluto mirror: http://www.pluto.linux.it/ildp/LDR Gaetano Paolone <bigpaul@flashnet.it> E non dimenticate Linuxlinks: http://jump.to/linuxlinks
On Sun, 16 Jan 2000, Il Paolone wrote: > Unable to connect to PostgresSQL server: connectDB() failed: Is the > postmaster running and accepting TCP/IP(with -i) connections at > 'bigpaul' on port '5432'? in /var/www/ciao.php3 on line 34 Is postmaster being started with the '-i' switch?? -- Lamar Owen WGCR Internet Radio 1 Peter 4:11
Lamar Owen wrote: > > On Sun, 16 Jan 2000, Il Paolone wrote: > > Lamar Owen wrote: > > > Is postmaster being started with the '-i' switch?? > I have found with deja, this french problem just now, I am trying, I'll let you know. ---------------------------------------------------------------------- Fait un petit tour dans le repertoire /etc/postgresql. Tu y trouveras des fichiers de config, dont postmaster.init qui contient une ligne pour autoriser les connexion TCP/IP : PGALLOWTCPIP=yes Ainsi que PGPORT=5432 pour definir le port TCP. Il y a aussi le fichier pg_hba.conf qui te permets d'autoriser les connexions a distances. ----------------------------------------------------------------------- YYYYYYYYEEEEEEEEEES! it works, once again deja.com saved me. And you also pushed me to look for the right solution. Thanks a lot. I also found this.... ------------------------------------------------------------------------------------ Check line 64 of /usr/lib/postgresql/bin/postgresql-startup. echo link it to /bin/true and run '/etc/init.d/postgresql start' There is a mis-matched quote mark. Change the first ` to a ' and the postmaster should start. -------------------------------------------------------------------------------------- -- LDR - Linux Domande e Risposte: http://web.tiscalinet.it/linuxfaq Pluto mirror: http://www.pluto.linux.it/ildp/LDR Gaetano Paolone <bigpaul@flashnet.it> E non dimenticate Linuxlinks: http://jump.to/linuxlinks
Hey All, It's the pg_Connect string that's giving you problems. Make sure that the syntax is pg_connect("host","port","database"). Also b/c it is most likely that user nobody is the owner of the webserver you will need to grant INSERT UPDATE and DELETE permission to nobody. HTH, Harry Hoffman Product Systems Specialist Restaurants Unlimited Inc. Seattle WA 206 634-3082 ext. 270 On Sun, 16 Jan 2000, Lamar Owen wrote: > On Sun, 16 Jan 2000, Il Paolone wrote: > > Unable to connect to PostgresSQL server: connectDB() failed: Is the > > postmaster running and accepting TCP/IP(with -i) connections at > > 'bigpaul' on port '5432'? in /var/www/ciao.php3 on line 34 > > Is postmaster being started with the '-i' switch?? > > -- > Lamar Owen > WGCR Internet Radio > 1 Peter 4:11 > > ************ >